Kodi Community Forum
MythTV PVR client Addon Developers Wanted - Developers Only! - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: MythTV PVR client Addon Developers Wanted - Developers Only! (/showthread.php?tid=82015)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35


- outleradam - 2010-11-06

^^ verified working.

The only thing left is to speed things up a bit.

I'm watching the monitor on my virtual machine and it says that it starts out with a bit of information and then xbmc does nothing, then it sends out more information and the screen comes up. This process takes about 14 seconds. For comparision, MythFrontend takes about 3.

Now, using my newer version of Myth_comm_Diag, http://www.mediafire.com/file/w91zk82zagp928t/Myth_Comm_Diag.jar I can see that the protocol must be using addition steps of some sort. In order to get the TV shows list it should be
MYTH_PROTO_VERSION
QUERY RECORDINGS

However, it would appear that instead it is making several other querys without parsing the results. Increasing the logging in commands sent from cMyth would be appreciated here. I believe, but cannot prove that XBMC is sending a request, and receiving the information, but not processing it.



On an unrelated note... Once you finish up the aforementioned project on identifying season and episode, it should be possible to scan Myth files directly into the library which would speed up execution, completely bypassing mythtv comunications using the QUERY_RECORDING command on the basename to obtain information for your scraper identification. I'm thinking that XBMC can scrape an entire folder as a mythtv library.


- PhracturedBlue - 2010-11-06

outleradam Wrote:^^ verified working.

The only thing left is to speed things up a bit.
Try this. It isn't complete yet, but it should significantly improve performance.
http://pastebin.com/EhDDa3Zj

Quote:On an unrelated note... Once you finish up the aforementioned project on identifying season and episode, it should be possible to scan Myth files directly into the library which would speed up execution, completely bypassing mythtv comunications using the QUERY_RECORDING command on the basename to obtain information for your scraper identification. I'm thinking that XBMC can scrape an entire folder as a mythtv library.

That would be possible, but I'm not sure why you think it would be faster than the current method.


- outleradam - 2010-11-07

^^Verified performance increase.

Significant improvement when listing titles. Connection is maintained when dropping from titles to main interface and there is nearly 0 delay between main and titles a second time. Speed is the same when going from Titles to episodes, connection is dropped and database is redownloaded when moving from episodes to Titles.

LiveTV is unchanged. That is definitely a step in the right direction though. I will want to run this as my default Live TV interface when it is finished. I hope I can map LiveTV to the TV button on my remote.

As for the quicker interface, it was simply an idea, a possibility for the future. It's never quicker to rely on a streaming backend when direct file access is possible. The files could be directly loaded as a folder instead of by utilizing backend links. It's just an idea. It would be unclean though as it would be possible to duplicate entries.


- PhracturedBlue - 2010-11-10

I added a new ticket with the cacheing code I posted above:
http://trac.xbmc.org/ticket/10672

I also added a new patch that continuously syncs mythtv to the Video library (for tvshows only for now) to:
http://trac.xbmc.org/ticket/10347
Note that last patch has only been lightly tested so far.

I am now running these myth related patches:
Code:
mythtv-tvshow-library.patch (10347)
improve_tv_sort.patch (10347)
import_missing_shows_r2.patch (10347)
myth_cache.patch (10672)
myth_no_timeout.patch (10672)
myth_video_refresh.patch (10347)

That gives me a reasonably working Library for my myth shows. Note that I never figured out how to auto-start the mythsession thread, so using the above patches, xbmc won't connect to myth until you access a myth directory or file. Once a connection is made, it should be persistent though.


- outleradam - 2010-11-11

I downloaded all patches mentioned above to my ~/xbmcsvn/trunk dir.
Code:
svn up  #selected theirs full
./configure
make clean
cat ./*.patch > ./patch.patch
patch -p0 <./patch.patch # a few conflicts, selected n, 3 lines failed
make -j5
failed make. trying again.


- outleradam - 2010-11-11

Code:
adam@adam-desktop:~/xbmcsvn/trunk$ svn revert ./ -R
Reverted 'xbmc/VideoInfoTag.cpp'
Reverted 'xbmc/FileSystem/IDirectory.cpp'
Reverted 'xbmc/FileSystem/Directory.cpp'
Reverted 'xbmc/FileSystem/IDirectory.h'
Reverted 'xbmc/FileSystem/MythSession.cpp'
Reverted 'xbmc/FileSystem/MythDirectory.cpp'
Reverted 'xbmc/FileSystem/Directory.h'
Reverted 'xbmc/FileSystem/MythDirectory.h'
Reverted 'xbmc/FileSystem/MythSession.h'
Reverted 'xbmc/screensavers/rsxs-0.9/configure'
Reverted 'xbmc/VideoInfoScanner.h'
Reverted 'xbmc/VideoInfoScanner.cpp'
adam@adam-desktop:~/xbmcsvn/trunk$ patch -p0 <./patch.patch
patching file xbmc/VideoInfoScanner.cpp
Hunk #1 succeeded at 280 (offset 2 lines).
Hunk #2 succeeded at 431 (offset 2 lines).
Hunk #3 succeeded at 475 (offset 2 lines).
patching file xbmc/FileSystem/MythDirectory.cpp
patching file xbmc/FileSystem/Directory.cpp
patching file xbmc/FileSystem/Directory.h
patching file xbmc/FileSystem/IDirectory.h
patching file xbmc/FileSystem/IDirectory.cpp
patching file xbmc/FileSystem/MythDirectory.h
patching file xbmc/FileSystem/MythSession.cpp
Hunk #1 FAILED at 165.
1 out of 1 hunk FAILED -- saving rejects to file xbmc/FileSystem/MythSession.cpp.rej
patching file xbmc/VideoInfoScanner.cpp
Hunk #1 FAILED at 1313.
1 out of 1 hunk FAILED -- saving rejects to file xbmc/VideoInfoScanner.cpp.rej
patching file xbmc/FileSystem/MythDirectory.cpp
patching file xbmc/FileSystem/MythSession.cpp
Hunk #2 succeeded at 355 (offset -3 lines).
Hunk #3 succeeded at 425 (offset -4 lines).
Hunk #4 succeeded at 547 (offset -4 lines).
patching file xbmc/FileSystem/MythSession.h
Hunk #1 succeeded at 59 (offset -1 lines).
Hunk #2 succeeded at 88 (offset -1 lines).
patching file xbmc/FileSystem/MythSession.cpp
patching file xbmc/VideoInfoTag.cpp
Hunk #1 succeeded at 614 (offset 48 lines).
patching file xbmc/FileSystem/MythSession.cpp
Hunk #1 succeeded at 170 (offset 6 lines).
patching file xbmc/VideoInfoScanner.h
patching file xbmc/VideoInfoScanner.cpp
Hunk #1 succeeded at 805 (offset 18 lines).
Hunk #2 succeeded at 1231 (offset 23 lines).
Hunk #3 succeeded at 1328 (offset 23 lines).
patching file xbmc/FileSystem/MythSession.cpp
Hunk #3 succeeded at 359 (offset -2 lines).
Hunk #4 succeeded at 435 (offset -3 lines).
patching file xbmc/FileSystem/MythSession.h
Hunk #1 succeeded at 89 (offset -1 lines).
adam@adam-desktop:~/xbmcsvn/trunk$
adam@adam-desktop:~/xbmcsvn/trunk$ cat xbmc/FileSystem/MythSession.cpp.rej
--- xbmc/FileSystem/MythSession.cpp.orig    2010-10-18 21:33:20.000000000 -0700
+++ xbmc/FileSystem/MythSession.cpp    2010-10-18 21:03:16.000000000 -0700
@@ -165,9 +165,12 @@
    */
   CStdString originalairdate = GetValue(m_dll->proginfo_originalairdate(program)).GetAsDBDate();
   if (originalairdate != "1970-01-01"
-  &&  originalairdate != "1969-12-31") // To deal with weird DST and timezone issues.
+  &&  originalairdate != "1969-12-31"  // To deal with weird DST and timezone issues.
+  &&  originalairdate != "7080-07-03") // Myth sometimes reports 0000-00-00
     tag->m_strFirstAired = originalairdate;

+  CStdString recordeddate = GetValue(m_dll->proginfo_start(program)).GetAsDBDate();
+  tag->m_strPremiered = recordeddate;
   /*
    * Video sort title is the raw title with the date appended on the end in a sortable format so
    * when the "All Recordings" listing is sorted by "Name" rather than "Date", all of the episodes
adam@adam-desktop:~/xbmcsvn/trunk$ cat ./xbmc/VideoInfoScanner.cpp.rej
--- xbmc/VideoInfoScanner.cpp.orig    2010-10-18 21:33:20.000000000 -0700
+++ xbmc/VideoInfoScanner.cpp    2010-10-18 21:31:17.000000000 -0700
@@ -1313,12 +1313,23 @@
         if (!file->tag.IsEmpty())
         {
           *item.GetVideoInfoTag() = file->tag;
+
+          /*
+           * If there is no airdate, but there is a premiere date, save that instead
+           */
+          if (item.GetVideoInfoTag()->m_strFirstAired.IsEmpty() && !item.GetVideoInfoTag()->m_strPremiered.IsEmpty())
+            item.GetVideoInfoTag()->m_strFirstAired = item.GetVideoInfoTag()->m_strPremiered;
+
           /*
-           * If the title for the episode is empty, then use the show title so it displays in the
-           * library sensibly.
+           * If the title for the episode is empty, then use the show title and airdate (if applicable)
+           * so it displays in the library sensibly.
            */
           if (item.GetVideoInfoTag()->m_strTitle.IsEmpty())
+          {
             item.GetVideoInfoTag()->m_strTitle = strShowTitle;
+            if (!item.GetVideoInfoTag()->m_strFirstAired.IsEmpty())
+              item.GetVideoInfoTag()->m_strTitle += " - " + item.GetVideoInfoTag()->m_strFirstAired;
+          }

           if (m_pObserver)
           {
adam@adam-desktop:~/xbmcsvn/trunk$

This worked after compiling, but there were errors. Tested working, with patch errors

[code]


- outleradam - 2010-11-11

One small problem left that I can see. When commanded to play LiveTV, XBMC is not checking if the backend is recording. This means when MythTV is recording, XBMC will timeout instead of recognizing that there are no live TV tuners

Code:
Sending:29      GET_NEXT_FREE_RECORDER[]:[]-1
28      1[]:[]192.168.1.110[]:[]654351



- PhracturedBlue - 2010-11-11

outleradam Wrote:
Code:
adam@adam-desktop:~/xbmcsvn/trunk$ patch -p0 <./patch.patch
...a bunch of stuff...

This worked after compiling, but there were errors. Tested working, with patch errors

The patches probably don't apply cleanly as there have been several intermediate code checkins since they were generated. I probably hav clean versions of them around, but I was pretty much waiting for dteirney to check in several of them before cleaning up the rest.
Namely, I think the following work well and are the correct approach for improving library integration:
Code:
mythtv-tvshow-library.patch (10347)
improve_tv_sort.patch (10347)
import_missing_shows_r2.patch (10347)

I think the myth_cache patch is fine too, but that is myth specific whereas the others really aren't, and maybe it should be ported to the pvr branch.


- dteirney - 2010-11-15

PhracturedBlue Wrote:I was pretty much waiting for dteirney to check in several of them before cleaning up the rest.

A bunch of the smaller patches for myth:// in trunk have been committed. The cache changes definitely make things more snappy. A similar caching approach can be applied to the PVR client even though it's using MythXML to get the list of recordings. Will look at how that approach can be triggered from the Myth Prototcol code once it's copied to the PVR branch.


- dteirney - 2010-11-15

outleradam Wrote:One small problem left that I can see. When commanded to play LiveTV, XBMC is not checking if the backend is recording. This means when MythTV is recording, XBMC will timeout instead of recognizing that there are no live TV tuners

Code:
Sending:29      GET_NEXT_FREE_RECORDER[]:[]-1
28      1[]:[]192.168.1.110[]:[]654351

Does this relate to the following (really old) trac ticket? http://trac.xbmc.org/ticket/4771


- outleradam - 2010-11-15

It sort of relates, but the problem is that XBMC does not say "There are no free tuners available" It just times out and says something like the recording would not play


- outleradam - 2010-11-20

PhracturedBlue: I came up with a confidence rating system which I believe you may be able to utilize
http://forum.xbmc.org/showpost.php?p=647932&postcount=629


- Katagia - 2010-11-25

I have the same problem
http://forum.xbmc.org/showthread.php?tid=86152

Sorry for creating a new thread, I needed a while to find this one.

I have the same problem with live TV. xbmc just hangs and timeouts.
Last lines in xbmc.log are:
22:13:36 T:140218700134464 M:2812592128 NOTICE: DVDPlayer: Opening: myth://mythtv:[email protected]/channels/28006.ts
22:13:36 T:140218700134464 M:2812592128 WARNING: CDVDMessageQueue(player):Tongueut MSGQ_NOT_INITIALIZED
22:13:36 T:140218146080528 M:2812592128 NOTICE: Creating InputStream

Mythtv backend show a similar error:
2010-11-25 22:31:29.928 MainServer::HandleVersion - Client speaks protocol version 8 but we speak 56!
2010-11-25 22:31:29.932 MainServer, Warning: Unknown socket closing MythSocket(0x7fc558021850)
2010-11-25 22:31:29.936 MainServer::ANN Playback

How can I fix this?

Cheers,


- tafypz - 2010-11-26

Sorry for the radio silence guys, I haven't been able to allocate time to continue the development, I have some time to allocate for this coming 2 weeks. I will continue on the timer refactoring (unless somebody took on that task)


- dteirney - 2010-11-28

tafypz Wrote:Sorry for the radio silence guys, I haven't been able to allocate time to continue the development, I have some time to allocate for this coming 2 weeks. I will continue on the timer refactoring (unless somebody took on that task)

I haven't been able to spend anytime doing the refactoring yet. My next plan is to get the tinyxml library committed (a real published version, not the slightly tweaked XBMC version) and try and get all the Make files working as expected. At the moment, the builds don't seem to be getting triggered correctly when source files change.