(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 » Wed Aug 15, 2018 8:10 pm

Ken.F wrote:
Tue Aug 14, 2018 5:47 pm
djp952 wrote:
Tue Aug 14, 2018 4:46 pm
GitHub ate my homework :(
Is it too soon to blame it on Microsoft?
Never. They are an easy and fun target, let's do it!

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 » Wed Aug 15, 2018 9:05 pm

For the folks that sent me some sample recordings they are having trouble with … first off, thank you again. Unfortunately I am seeing pretty much the same thing you are without much explanation. They all seem to be perfectly valid from an MPEG-TS stream perspective, none of them have any corruption or continuity issues. They all seem to play fine on Windows.

On Android it's a different story. What I'm able to see so far is that Kodi simply stops asking for data while it tries to deal with whatever it's dealing with. Same results with the .MPG files shared as regular 'Videos' as opposed to streaming them through the PVR, seeking around is bad and causes the exact same problems.

While this appears to definitely eliminate the PVR client as the culprit as you guys already surmised based on your testing, I will continue to see if I can find if there is a "poison pill" of some kind in the stream than Android can't handle. Based on the Kodi logs it just doesn't like the streams for audio sync reasons regardless of where or how I play the files.

I'm not hopeful there is anything I can really do about this, but since the behavior is exactly the same just playing the .MPG directly it may be worth your while to try and contact Team Kodi on their forums to see if they can do anything about it before the release of Leia. You don't even need to mention the PVR, it's just an MPEG-TS file that has difficulty playing on Android in general.

Skyecairns
Posts: 38
Joined: Sun Jul 22, 2018 6:58 am

Disabling Channel Logo Update

Post by Skyecairns » Thu Aug 16, 2018 4:16 pm

per Documentation:

Electronic Program Guide (EPG) Metadata
Sets the interval at which the Electronic Program Guide metadata (channel names, channel logos, etc.) is retrieved from the HDHomeRun DVR backend services.


Is there some way to disable the channel logos update? I have a bunch of logos from my TV Channels which I installed but they keep getting written over with smaller and some cases hard to see channel logos? Thanks

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

Re: Disabling Channel Logo Update

Post by djp952 » Thu Aug 16, 2018 4:39 pm

Skyecairns wrote:
Thu Aug 16, 2018 4:16 pm
per Documentation:

Electronic Program Guide (EPG) Metadata
Sets the interval at which the Electronic Program Guide metadata (channel names, channel logos, etc.) is retrieved from the HDHomeRun DVR backend services.


Is there some way to disable the channel logos update? I have a bunch of logos from my TV Channels which I installed but they keep getting written over with smaller and some cases hard to see channel logos? Thanks
Sure! Easy enough. Seems like a quite reasonable option to add. Let me play with some custom channel logos and see if just not giving Kodi the URLs from the guide data is sufficient to have yours not be overwritten.

ddejager
Posts: 107
Joined: Tue May 06, 2014 2:26 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager » Thu Aug 16, 2018 6:46 pm

djp952: Did you ever give more thought to how to recover when contact is lost with the tuner resulting in all the guide data being cleared until a manual reset (Clear Guide Data) is performed? Recall that this happens in my situation where the tuner is on my LAN but on the other side of a long wireless link and the link drops occasionally. Thanks.

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 » Thu Aug 16, 2018 8:20 pm

ddejager wrote:
Thu Aug 16, 2018 6:46 pm
djp952: Did you ever give more thought to how to recover when contact is lost with the tuner resulting in all the guide data being cleared until a manual reset (Clear Guide Data) is performed? Recall that this happens in my situation where the tuner is on my LAN but on the other side of a long wireless link and the link drops occasionally. Thanks.
Oooooo… I do recall this now, I wish I wrote up an Issue on GitHub before my disappearance I would have knocked this out for you. I believe we discussed that when the tuners disappear or aren't reachable the way the PVR is coded right now it says "hey, the tuners changed" or "hey, the lineups changed" and of course Kodi goes and deletes all it's channels since now there are none. Since Kodi can't handle adding Guide data for newly added channels until you bounce it or clear data you end up with an empty EPG even though the channels came back at some point.

Looking at the code right now, I definitely never did anything about this. Would you mind if we rehash it now to see how it could work?

I think what we ultimately came up with last time was along the lines of making a complete lack of tuners being detected as an error condition rather than a realistic result, especially if there used to be tuners. If all the tuners really disappeared or were turned off or whatever, nothing will work anyway so having stale metadata doesn't really matter -- things will fall apart for the user pretty quickly. So I think that's part of a possible solution -- if absolutely no tuners were found, abort the device update, which would in turn also not force a lineup (channel) update.

The other part to deal with is the regular periodic lineup (channel) update. If a tuner doesn't respond to the query an HTTP error of some kind should be returned. I coded in 2 methods for handling that, the first being throw an error, the other is to fail silently with some default value. The lineup query is set for the first method - throw an error - so any non-response from any tuner device should already be aborting that entire operation. We may not need to do anything at all here.

So, this may be as simple as just adding the case for having no tuners being an error that gets logged and leaves the current device list (even if already blank) alone. That would also apply during startup, so if you had tuners and none were found the existing data would be used. Side effect ... if the tuner data isn't refreshed the device authorization codes will also go stale, which means your backend queries may fail until that data becomes good again. It should keep the channels in Kodi, though, which in turn should stop the EPG from completely clearing out, which is the goal.

Does this sound reasonable? I can test the proposed change and let you know, but if you think there is a hole in the logic or a better way (short of retrying the operations, which is logistically much harder to do than you think it would be) please divulge!

ddejager
Posts: 107
Joined: Tue May 06, 2014 2:26 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager » Fri Aug 17, 2018 8:08 am

I think that your proposal for how to deal with all tuners temporarily disappearing sounds reasonable. I have two questions about it:
1) How often will it check for the tuners return when they have disappeared? (I assume when you realize that the tuner(s) is back you will update the guide.)
2) I don't really understand the architecture well enough to comment on the back-end implications. In my case I have two instances of Kodi running in the house...one on a firestick and one under OSMC on a raspberry pi. My HDHomeRun DVR runs on a windows machine. The DVR does not seem to have problems with the tuners going/coming (obviously the tuner needs to be accessible when a recording is going). So what do you mean about the back-end queries failing?

Thanks.

signcarver
Expert
Posts: 8249
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by signcarver » Fri Aug 17, 2018 8:22 am

If you look at that sentence, it is about the DeviceAuth which deals with accessing your DVR account (rules/tasks) and guide with SD... every 8 hours (and each reboot of the device), the tuner renews this (and changes) so such "key" to access your account could go stale.

ddejager
Posts: 107
Joined: Tue May 06, 2014 2:26 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager » Fri Aug 17, 2018 8:54 am

signcarver wrote:
Fri Aug 17, 2018 8:22 am
If you look at that sentence, it is about the DeviceAuth which deals with accessing your DVR account (rules/tasks) and guide with SD... every 8 hours (and each reboot of the device), the tuner renews this (and changes) so such "key" to access your account could go stale.
Sorry, I don't understand the issue. if I have two clients (one firestick and one OSMC box) and physically turn them off for three days or a week while I'm gone, but leave the DVR running on a windows machine, all works well and recordings get made. So what is it that goes stale and would fail to work?

signcarver
Expert
Posts: 8249
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by signcarver » Fri Aug 17, 2018 9:48 am

getting guide data or the client viewing/setting tasks... I would not expect one to have most of such problems if any tuner can be seen... it is just a possibility and the fewer tuners seen increases the possibility of issues but the way this client "illegally" handles data it is likely you may never actually see an issue even if such error occurs or even care about what is missing at the time.

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 » Fri Aug 17, 2018 1:17 pm

ddejager wrote:
Fri Aug 17, 2018 8:08 am
I think that your proposal for how to deal with all tuners temporarily disappearing sounds reasonable. I have two questions about it:
1) How often will it check for the tuners return when they have disappeared? (I assume when you realize that the tuner(s) is back you will update the guide.)
2) I don't really understand the architecture well enough to comment on the back-end implications. In my case I have two instances of Kodi running in the house...one on a firestick and one under OSMC on a raspberry pi. My HDHomeRun DVR runs on a windows machine. The DVR does not seem to have problems with the tuners going/coming (obviously the tuner needs to be accessible when a recording is going). So what do you mean about the back-end queries failing?

Thanks.
The default is to check every 5 minutes. It should be pretty unlikely that they would be undiscoverable every 5 minutes for a period of time protracted enough to actually cause you any problems with the device authorization codes, as signcarver discussed above.

I don't know what method the SD DVR engine uses, I assume it's the HTTP web services query to silicondust as opposed to broadcast via libhdhomerun. That being the case I also assume that the HTTP web services have some reasonable timeout that says if a tuner hasn't checked in for X number of minutes, take it out of the list. This can be seen by unplugging a tuner, the web services will report it exists for a while, but it will immediately become unresponsive to broadcast (as one would expect).

This code can go both ways, default is HTTP web services but can be configured for legacy broadcast discovery with the "Use network broadcast for device discovery" option. Web services method will be less prone to disappearing tuners due to transient conditions, but it doesn't work for everyone for whatever reason. IIRC you needed to use broadcast discovery. HTTP discovery, if it works, would also likely solve your problem as the tuners won't disappear from the list as easily.

edit: regardless, change has been made for next version (1.3.3). Seems to work acceptably well and as long as the auth codes cached in the database are still good, everything else will continue to work just fine, and the channels are not purged. Also confirmed that if the auth codes are NOT still good all hell breaks loose, also as anticipated. There is a relatively new catch in the EPG part that will shut you down for a while and not nuke the backend if it says you are unauthorized. Kodi, however, will absolutely complain about each channel in the log :)
Last edited by djp952 on Fri Aug 17, 2018 2:05 pm, edited 1 time in total.

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 » Fri Aug 17, 2018 1:20 pm

ddejager wrote:
Fri Aug 17, 2018 8:54 am
signcarver wrote:
Fri Aug 17, 2018 8:22 am
If you look at that sentence, it is about the DeviceAuth which deals with accessing your DVR account (rules/tasks) and guide with SD... every 8 hours (and each reboot of the device), the tuner renews this (and changes) so such "key" to access your account could go stale.
Sorry, I don't understand the issue. if I have two clients (one firestick and one OSMC box) and physically turn them off for three days or a week while I'm gone, but leave the DVR running on a windows machine, all works well and recordings get made. So what is it that goes stale and would fail to work?
As long as the tuners are still turned on! The client(s) (this, HDHomeRun app, etc) have no bearing on the ability for the DVR engine to do what it does. It just chugs along doing it's thing whether you're there to watch it or not :)

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

Re: Disabling Channel Logo Update

Post by djp952 » Fri Aug 17, 2018 1:58 pm

djp952 wrote:
Thu Aug 16, 2018 4:39 pm
Skyecairns wrote:
Thu Aug 16, 2018 4:16 pm
per Documentation:

Electronic Program Guide (EPG) Metadata
Sets the interval at which the Electronic Program Guide metadata (channel names, channel logos, etc.) is retrieved from the HDHomeRun DVR backend services.


Is there some way to disable the channel logos update? I have a bunch of logos from my TV Channels which I installed but they keep getting written over with smaller and some cases hard to see channel logos? Thanks
Sure! Easy enough. Seems like a quite reasonable option to add. Let me play with some custom channel logos and see if just not giving Kodi the URLs from the guide data is sufficient to have yours not be overwritten.
Hi Skyecairns! It seems there may not need to be any changes at all here. I was able to apply a custom logo to a channel that wasn't overwritten by the URL provided by the backend services.

Here's what I did (Kodi 17.6 "Krypton"), basically just following this list I found after the fact: https://kodi.wiki/view/Live_TV_Artwork

> Go into PVR & Live TV Settings
> Select General / Channel Manager
> Highlight the channel in the left-hand pane
> Select "Channel logo" in the right-hand pane
> Select "Browse..." and pick the logo you want

The logo I picked appears to persist just fine across invocations of Kodi and is not being overwritten by the one specified by the PVR.

I can still add an option to completely disable the logos, so if I'm misunderstanding the need let me know. When I tested it, Kodi just gave me no logos at all, and I still had to go into Channel Manager and Browse for the one I wanted. Seems like Kodi has this handled on it's own?

PS - The logos I get from the backend seem quite nice, have you considered asking SiliconDust if they can get the data provider to improve the ones you find unacceptable? Just wondering since this seems like a lot of effort to use custom ones.

ddejager
Posts: 107
Joined: Tue May 06, 2014 2:26 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager » Fri Aug 17, 2018 3:00 pm

Also confirmed that if the auth codes are NOT still good all hell breaks loose, also as anticipated. There is a relatively new catch in the EPG part that will shut you down for a while and not nuke the backend if it says you are unauthorized.
Thanks for making the change for next release!

So if/when "all hell breaks loose", how long will it take (after the tuner becomes available again) before the EPG will be properly updated?

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 » Fri Aug 17, 2018 6:29 pm

ddejager wrote:
Fri Aug 17, 2018 3:00 pm
Also confirmed that if the auth codes are NOT still good all hell breaks loose, also as anticipated. There is a relatively new catch in the EPG part that will shut you down for a while and not nuke the backend if it says you are unauthorized.
Thanks for making the change for next release!

So if/when "all hell breaks loose", how long will it take (after the tuner becomes available again) before the EPG will be properly updated?
The next device refresh (5 minutes) will unlock the EPG function and allow Kodi to try again at it's next interval. I believe the default in Kodi is 120 minutes, that's configurable from PVR & Live TV settings.

I think the tweak will do the trick for you and you really won't run into any major hassles whatsoever. Maybe not perfect at the first attempt (when has anything I've done here been perfect? LOL) but I honestly don't foresee any fire and/or brimstone hailing down upon your Kodi :)

Locked