OLD: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Kodi Community Development

Moderator: TVJunkie198

Locked
djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Sat Mar 18, 2017 1:07 pm

wex101 wrote:
Fri Mar 17, 2017 10:32 pm
I'm seriously thrilled by how helpful you've been. Thank you son much! By chance do you have donations set up so I could buy you a beer?
Nah, I appreciate the sentiment, however. I wouldn't feel right accepting anything, and besides if I screw up somebody's PC I can always claim that "you get what you pay for" LOL

!!Long post warning!!

As for the DSPlayer crash, I have good and bad news. The good news is that I was able to build DSPlayer (x64) and see exactly where it's crashing. The bad news is that it's not in my code.

Here's what's going on .. it seems that DSPlayer isn't obeying the Kodi API under some circumstances. My PVR does the channel streaming on it's own to handle the HDHomeRun RECORD engine requirements for seeking and setting a client id, and so on. There is a flag you set for Kodi that tells it that, this flag isn't being obeyed by DSPlayer all the time for some reason. The crash happens when DSPlayer calls a function in my PVR called "GetLiveStreamURL", which returns a null pointer (the 0x00000000) by design. DSPlayer then tries to use that null pointer as a string and bang - access violation. "GetLiveStreamURL" is only supposed to be called when a PVR doesn't do it's own streaming, that tells Kodi the URL to use. The official Kodi HDHomeRun PVR streams via this method, so it won't crash.

Interestingly, if you use the "Recently Played Channels" tiles in the TV section, they work fine :) You just have to pick a channel, crash Kodi, restart it, then use that tile! LOL, easy right? Best. Workaround. Ever! j/k of course.

I can prevent the crash by returning an empty string rather than a null pointer, but that doesn't really solve anything as you still won't get the channel to play, it will just sit and stare at you like "ummmmm ... wha?".

Here's what I can do .. I can step through DSPlayer tonight or tomorrow and provide the author with a pull request (if I can fix it), or at least write him/her a message about the problem on the Kodi forums. My gut tells me this is a Kodi x64 bug rather than a DSPlayer specific bug, which might delay a resolution depending on how the DSPlayer author feels about it.

I can also add something in this PVR to disable the fancy streaming stuff and rely on just giving Kodi a URL like the official HDHomeRun PVR does. You will lose the ability to seek/timeshift (properly) and also the ability to pause. Losing pause seems to be a Kodi thing, if you tell it "you can't seek" it implies "you can't pause", which is silly, but whatever. The biggest limitation here is that changing this would require a (Kodi) restart as I'd have to tell Kodi/DSPlayer at startup that it needs to handle the stream.

Let me poke around in the DSPlayer code and see how bad the problem appears to be, maybe we'll get lucky and it's a quick fix we can publish for the author and get you up and running.

As for right this minute I recommend switching back to the regular Kodi HDHomeRun PVR for use with DSPlayer. :| Sorry!!

Rickt1962
Posts: 134
Joined: Tue Dec 01, 2015 2:17 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by Rickt1962 » Sat Mar 18, 2017 2:48 pm

Will this work on OSMC using a Raspberry Pi-3 ?

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Sat Mar 18, 2017 3:52 pm

Rickt1962 wrote:
Sat Mar 18, 2017 2:48 pm
Will this work on OSMC using a Raspberry Pi-3 ?
Hmmm.... that would require an ARM Linux build which I don't have available. It runs on Android ARM so I think it may just be a matter of putting together a normal GNU Linux ARM build to try. Unfortunately I have absolutely no way to test such a thing. I can check into it, but I have nothing that would work at the moment. Sorry :(

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Sat Mar 18, 2017 4:09 pm

djp952 wrote:
Sat Mar 18, 2017 1:07 pm
Let me poke around in the DSPlayer code and see how bad the problem appears to be, maybe we'll get lucky and it's a quick fix we can publish for the author and get you up and running.

As for right this minute I recommend switching back to the regular Kodi HDHomeRun PVR for use with DSPlayer. :| Sorry!!
OK, as for DSPlayer Kodi I have worse news to go with the above bad news. The incompatibility is pretty systemic. DSPlayer implements a whole new video player (which is the whole point of it), but I ultimately ran into an insurmountable roadblock. The reason DSPlayer is asking for the URL is so it can handle the stream and do fun DSPlayer stuff with it, as expected, but even doing it that way it doesn't like the HDHomeRun RECORD engine streams. Won't play them. It tries and just gets all wonky inside -- the rabbit hole was getting deep and well beyond the "quick fix" zone, so I'm pronouncing this one dead.

If I send DSPlayer a URL from a tuner device, it seems to work OK just like the Kodi HDHomeRun addon, but when I give it the URL from the RECORD engine, it won't do anything at all. Unfortunately, using the RECORD engine is kind of the whole point of this project. I let the RECORD engine do all the work -- tuner selection, load balancing, timeshifting, everything comes through that system.

Nothing I can do about this one, it's just not gonna work. Really sorry wex101 :cry:

PS - I found out why the "Recently Played Channels" tiles work -- there is a bug in DSPlayer that sends those channel requests through the standard Kodi video subsystem, basically it bypasses itself. Pretty cool bug, but didn't help solve the problem ...

Geez, all bad news and "no"s instead of "yes"s today. I'm going back to bed!!

wex101
Posts: 18
Joined: Thu Jan 12, 2017 4:45 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by wex101 » Sat Mar 18, 2017 9:59 pm

Thank you for spending so much time with this. I believe there is a way to specify specific content that you want to dsplayer to not be used in Kodi. I'll look into it and post back.

Edit: okay so here is a playercorefactory file designed for telling Kodi to use the dvdplayer instead of dsplayer for http streams. Could this be edited in some way to make the video stream work?

https://drive.google.com/file/d/0B2LAr9 ... sp=sharing

agressiv
Posts: 19
Joined: Sun Apr 17, 2016 9:00 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by agressiv » Sun Mar 19, 2017 9:56 am

I'm messing with different linux distributions and backing up my .kodi directory each time I try one.

On regular ubuntu 16.10 (I had been using xubuntu), I ran into this:

Code: Select all

11:42:14.495 T:139619005605632  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: initiated local network device discovery
11:42:14.690 T:139619005605632  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: scheduling next device discovery to initiate in 300 seconds
11:44:03.555 T:139618506761984   ERROR: CPVRTimerType::CreateFromAttributes unable to resolve timer type (0x1, 0xa, 1037099430)
11:45:45.500 T:139619433043712   ERROR: Previous line repeats 13 times.
This results in hanging the main thread of kodi, and I'm unable to quit the application. You'll see "preparing 0%" up in the corner forever.
* I'm able to watch Live TV
* I'm able to record a program on-demand
* I'm able to watch existing recordings

My guess is that this is the job to check the recording engine for the native jobs. When I restarted the recording engine (which runs on a different machine), killed kodi (using killall kodi and killall kodi.bin), and then re-launched, it was fine.

My point here being if that CPVRTimerType message recurs this much, it should give up after X amount of tries and alert the user that they should restart their engine. It shouldn't hang kodi like this.

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Sun Mar 19, 2017 10:44 am

wex101 wrote:
Sat Mar 18, 2017 9:59 pm
Thank you for spending so much time with this. I believe there is a way to specify specific content that you want to dsplayer to not be used in Kodi. I'll look into it and post back.

Edit: okay so here is a playercorefactory file designed for telling Kodi to use the dvdplayer instead of dsplayer for http streams. Could this be edited in some way to make the video stream work?

https://drive.google.com/file/d/0B2LAr9 ... sp=sharing
Hmmm... maybe! All the HDHomeRun streams are indeed http so it sounds pretty promising. I'll set up DSPlayer again and see what I can find out for ya.

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Sun Mar 19, 2017 11:13 am

agressiv wrote:
Sun Mar 19, 2017 9:56 am
I'm messing with different linux distributions and backing up my .kodi directory each time I try one.

On regular ubuntu 16.10 (I had been using xubuntu), I ran into this:

Code: Select all

11:42:14.495 T:139619005605632  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: initiated local network device discovery
11:42:14.690 T:139619005605632  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: scheduling next device discovery to initiate in 300 seconds
11:44:03.555 T:139618506761984   ERROR: CPVRTimerType::CreateFromAttributes unable to resolve timer type (0x1, 0xa, 1037099430)
11:45:45.500 T:139619433043712   ERROR: Previous line repeats 13 times.
This results in hanging the main thread of kodi, and I'm unable to quit the application. You'll see "preparing 0%" up in the corner forever.
* I'm able to watch Live TV
* I'm able to record a program on-demand
* I'm able to watch existing recordings

My guess is that this is the job to check the recording engine for the native jobs. When I restarted the recording engine (which runs on a different machine), killed kodi (using killall kodi and killall kodi.bin), and then re-launched, it was fine.

My point here being if that CPVRTimerType message recurs this much, it should give up after X amount of tries and alert the user that they should restart their engine. It shouldn't hang kodi like this.
The "CPVRTimerType::CreateFromAttributes..." is unfortunately normal and expected. This is Kodi telling you that the PVR Client hasn't implemented a certain timer type, in this case one that is based solely on a date/time and a channel. There is no way to schedule a recording without a 'seriesid' on the HDHomeRun DVR backend. This is a known limitation: https://github.com/djp952/pvr.hdhomerun ... in-kodilog

As to the UI locking up, all of the discovery is handled asynchronously except at first launch. At launch, if the database has no channels in it, the addon will perform an initial device and lineup discovery during load; if this part has a problem it could definitely give you that 0% indicator for a while, perhaps forever if something went truly wonky (This is actually a workaround for a Kodi thing that would cause you to have no guide data when channels are added after add-on launch). If the client is doing that you should see a message "no channels detected in the database -- execute device and lineup discovery now" in the logs. Otherwise, all discovery is asynchronous and shouldn't have any effect on the Kodi UI. Shouldn't being the operative word, there could of course be a bug!

Based on the log snippet it seems that the device discovery is happening very fast, do you see the remaining 5 tasks executing in the log after the CPVRTimer messages, or did Kodi die at that point? For example, here's what I see in the logs for a normal startup, complete with the CPVRTimer messages:

Code: Select all

13:00:31.448 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: initiated local network device discovery
13:00:31.636 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_devices_task: scheduling next device discovery to initiate in 300 seconds
13:00:31.734 T:10036   ERROR: CPVRTimerType::CreateFromAttributes unable to resolve timer type (0x1, 0xa, 235985751)
13:00:32.637 T:8716   ERROR: Previous line repeats 37 times.
13:00:32.637 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_lineups_task: initiated local tuner device lineup discovery
13:00:32.837 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_lineups_task: scheduling next lineup discovery to initiate in 600 seconds
13:00:33.839 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_recordings_task: initiated local storage device recording discovery
13:00:33.920 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_recordings_task: scheduling next recording discovery to initiate in 600 seconds
13:00:34.921 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_guide_task: initiated electronic program guide discovery
13:00:35.077 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_guide_task: scheduling next guide discovery to initiate in 1800 seconds
13:00:36.077 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_recordingrules_task: initiated recording rule discovery
13:00:36.271 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_recordingrules_task: scheduling next recording rule discovery to initiate in 7200 seconds
13:00:37.272 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_episodes_task: initiated recording rule episode discovery
13:00:41.680 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_episodes_task: recording rule episode discovery data changed -- trigger electronic program guide update
13:00:41.703 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_episodes_task: recording rule episode discovery data changed -- trigger timer update
13:00:41.703 T:8716  NOTICE: AddOnLog: HDHomeRun DVR PVR Client: discover_episodes_task: scheduling next recording rule episode discovery to initiate in 7200 seconds
The second task to execute should be the 'discover_lineups_task'. It writes the 'initiated' message into the log immediately, but Kodi doesn't flush the log messages to disk immediately so even if it's occurring we may not get it in the log if Kodi locks up or is killed. The only other way I can think of that the addon could really lock up Kodi is if there is some problem with reading the contents of it's database. If Kodi asks for a channel list, for example, and the addon goes into lala land responding, that would certainly do it.

If you can watch TV and watch recordings, it would seem that most everything is working OK. Are you getting EPG data loaded properly? Any other PVR clients installed?

One thing you can try would be to clear the PVR data in Kodi -- Settings/PVR & Live TV Settings/General/Clear Data. This will nuke all of the Kodi PVR tables and trigger a reload from the PVR client(s). If there is a bug in the client I would expect the same 0% to occur, but maybe if something is slightly out of whack in the Kodi database it might clear up?

Let me know how you would like to proceed; I'm happy to look at your Kodi logs or even the PVR database file (only identifying info inside is the HDHomeRun device ids - nothing about you or your computer). PM me if you want to send me file(s).

OH - One more thing -- this is Linux ... run 'kodi' from a terminal rather than the shell; I write errors to stderr as well as the Kodi log, so if Kodi dies after an error we should see it that way ...

agressiv
Posts: 19
Joined: Sun Apr 17, 2016 9:00 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by agressiv » Sun Mar 19, 2017 11:52 am

That's the thing, it never actually dies - just the opposite, a thread is hung and while kodi is otherwise usable, the 0% in the corner is permanent and you are unable to quit without at least a SIGHUP.

If it happens again, I'll enable debug logging. There was no other obvious error messages, when I tried to gracefully quit, it showed it attempting to quit but simply nothing happening after that.

No other PVR clients are enabled, and EPG is loading properly. I'll try the other troubleshooting steps if/when it happens again.

(I've had problems with the EPG being blank, but if I wait a few minutes, it usually appears on its own....)

wex101
Posts: 18
Joined: Thu Jan 12, 2017 4:45 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by wex101 » Sun Mar 19, 2017 3:50 pm

djp952 wrote:
Sun Mar 19, 2017 10:44 am
wex101 wrote:
Sat Mar 18, 2017 9:59 pm
Thank you for spending so much time with this. I believe there is a way to specify specific content that you want to dsplayer to not be used in Kodi. I'll look into it and post back.

Edit: okay so here is a playercorefactory file designed for telling Kodi to use the dvdplayer instead of dsplayer for http streams. Could this be edited in some way to make the video stream work?

https://drive.google.com/file/d/0B2LAr9 ... sp=sharing
Hmmm... maybe! All the HDHomeRun streams are indeed http so it sounds pretty promising. I'll set up DSPlayer again and see what I can find out for ya.
Here are a couple threads about getting mediaportal and npvr plugins working

http://forum.kodi.tv/showthread.php?tid ... pid2111042

http://forum.kodi.tv/showthread.php?tid ... pid2090836

I've been trying random stuff but no success yet.

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Mon Mar 20, 2017 2:20 pm

Rickt1962 wrote:
Sat Mar 18, 2017 2:48 pm
Will this work on OSMC using a Raspberry Pi-3 ?
Guess what just came in the mail today ... a Raspberry Pi 3 :) How coincidental! I've always wanted a reason, you gave me one! LOL.

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Mon Mar 20, 2017 7:17 pm

wex101 wrote:
Sun Mar 19, 2017 3:50 pm
Here are a couple threads about getting mediaportal and npvr plugins working

http://forum.kodi.tv/showthread.php?tid ... pid2111042

http://forum.kodi.tv/showthread.php?tid ... pid2090836

I've been trying random stuff but no success yet.
Hold tight for a few days, I have something in mind that will work, I just need to see how it will fit together. I'm going to add a "Stream Live TV directly from tuner devices" (or something like that) option that switches LiveTV to using the tuners themselves just like the official HDHomeRun addon does. I need to figure out the least intrusive way to enable that and then add code to locate and use an available tuner for whatever channel is being requested. It shouldn't be that hard, the database already knows all of this from tuner discovery, I just don't currently use it.

Note that you will lose timeshifting (seek) and pause functionality. I know the official addon allows seek, but it doesn't really work (no offense to that developer; nature of the beast). Pause, as stated somewhere above, gets lost due to a Kodi quirk. It requires seek to be enabled to pause. If that pause limitation becomes a problem it can be another option to allow it with the caveat that seek will appear broken. (One of the things on my list of stuff to look at in Kodi itself when I can)

I think this will be the best solution; you still get the ability to control the timers/rules and recorded TV and it should still be a step up from the official addon since I can deal with channel duplication across devices more easily since I've put everything into a database :) And -- no tweaks/hacks for DSPlayer!!

wex101
Posts: 18
Joined: Thu Jan 12, 2017 4:45 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by wex101 » Mon Mar 20, 2017 10:11 pm

That all sounds wonderful. I would keep pausing as an option with broken seek.

In the video addon I am able to work around all that by just watching a currently recording show from the recording instead of live. Will that work around still work?

djp952
Posts: 897
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 » Tue Mar 21, 2017 8:58 pm

wex101 wrote:
Mon Mar 20, 2017 10:11 pm
That all sounds wonderful. I would keep pausing as an option with broken seek.

In the video addon I am able to work around all that by just watching a currently recording show from the recording instead of live. Will that work around still work?
Absolutely. The beast I'm creating doesn't change anything about Recorded TV, just Live TV. Recorded TV has always just sent Kodi a URL to the file, nothing fancy was there.

agressiv
Posts: 19
Joined: Sun Apr 17, 2016 9:00 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by agressiv » Wed Mar 22, 2017 5:45 pm

Got the "Preparing: 0%" to happen again. Only seems to happen on linux, it's not happening on my Windows machine. I'll mail you the kodi.log and DB, nothing was written to stdout/stderr.

Tried the "Clear PVR data bit", didn't help. Still have to killall kodi and kodi.bin.

Locked