Unofficial Kodi HDHomeRun DVR PVR Client

Kodi Community Development

Moderator: TVJunkie198

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

Rickt1962 wrote:
Sun Dec 15, 2019 6:29 am
I am using djp952 3.0.0 on KODI and this morning the guide is blank rebooted and still blank :o I dont have a subscription only need 1 day guide which I thought was free
Hey, if you're not too angry with me right now, may I ask what benefits this addon had over the pvr.hdhomerun one built into Kodi for you without the DVR features? I'd like to try and copy/port over anything that made this better for people to the formal Kodi one. PSA, though, that addon at last check (yesterday) was only getting 4 hours of EPG now as well. It could be a glitch, but it's possible the API itself is going away completely for all applications so that addon may end up in the same place.

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by Rickt1962 »

djp952 wrote:
Sun Dec 15, 2019 7:02 am
Rickt1962 wrote:
Sun Dec 15, 2019 6:29 am
I am using djp952 3.0.0 on KODI and this morning the guide is blank rebooted and still blank :o I dont have a subscription only need 1 day guide which I thought was free
Hey, if you're not too angry with me right now, may I ask what benefits this addon had over the pvr.hdhomerun one built into Kodi for you without the DVR features? I'd like to try and copy/port over anything that made this better for people to the formal Kodi one. PSA, though, that addon at last check (yesterday) was only getting 4 hours of EPG now as well. It could be a glitch, but it's possible the API itself is going away completely for all applications so that addon may end up in the same place.
Could you post a link to 2.4.2 please :D

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

Rickt1962 wrote:
Sun Dec 15, 2019 8:02 am
Could you post a link to 2.4.2 please :D
All historical releases are available and linked to from the "Release History" page:
https://github.com/djp952/pvr.hdhomerun ... se-History

DISCLAIMER: Prior versions may not work at all anymore, and the ones that still do may not work for long (and I firmly believe in this case the latter statement will become true in the near future for v2.4.2)

Also, be sure to turn OFF auto-update in Kodi otherwise the most current version of the addon will eventually find it's way back to you.

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by signcarver »

I do think it would be nice for SD to give the 4 hour guide to those without dvr but I can understand them wanting to get people to pay for guide as the data isn't free. It would be nice of them to say yes they will continue to support that and a "final" non-dvr version released to support such.

With grid guide, I have easily noticed some discrepancies between the two... for instance 5, 1005 (cable) and 5.1(ota) should have the same programming and for the most part they do... and 5 should always match 1005 but in this case on 5 they cut short nfl today by 15 minutes and added a couple of movies and lasts over where there should be infomercials before the later nfl game when the schedule resumes properly. Also I have an OTA channel 10.2 that should match 10, 1010, and 10.1 as it is an SD version of 10.1 and the grid guide showed a movie on during the Fox pregame show. I'm probably am going to need a refresher of getting the xml data (been using json for far too long) as it always seems to time out for me prior to being able to use it so I can't easily check if this might be a case of extra erratic data being added that somehow gets added back into the grid overriding the real data. All I know is that the data in the HDHomeRun app is more correct. I guess I could also check my schedules direct stuff and see if it is similarly affected.

ddejager
Posts: 131
Joined: Tue May 06, 2014 2:26 pm
Location: Glen Arbor, MI

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by ddejager »

NedS wrote:
Sat Dec 14, 2019 8:02 pm
ddejager wrote:
Sat Dec 14, 2019 3:13 pm
So, is there any way SD will consider a method to allow non-DVR subscribers to get 23 hours worth of guide data, other than via the official HDHomeRun app? If not I guess I will need to start recommending other solutions for people who do not want/need a DVR. Sad.
I can inquire, but just to let you know, the Kodi PVR add-on in the Kodi.TV add-on repo should still work, minus DVR features. The only bad thing with it is that the channel numbers don't always line up right, but it should still give you a grid guide.
NedS, Thanks. Obviously we do not want to load down the SD servers. I would be nice to have a good lineup so if permission could be granted to this Client to do the same (and nothing more) than what the Kodi PVR add-on in the Kodi.TV repo does, that would be nice.

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

signcarver wrote:
Sun Dec 15, 2019 10:18 am
I do think it would be nice for SD to give the 4 hour guide to those without dvr but I can understand them wanting to get people to pay for guide as the data isn't free. It would be nice of them to say yes they will continue to support that and a "final" non-dvr version released to support such.

With grid guide, I have easily noticed some discrepancies between the two... for instance 5, 1005 (cable) and 5.1(ota) should have the same programming and for the most part they do... and 5 should always match 1005 but in this case on 5 they cut short nfl today by 15 minutes and added a couple of movies and lasts over where there should be infomercials before the later nfl game when the schedule resumes properly. Also I have an OTA channel 10.2 that should match 10, 1010, and 10.1 as it is an SD version of 10.1 and the grid guide showed a movie on during the Fox pregame show. I'm probably am going to need a refresher of getting the xml data (been using json for far too long) as it always seems to time out for me prior to being able to use it so I can't easily check if this might be a case of extra erratic data being added that somehow gets added back into the grid overriding the real data. All I know is that the data in the HDHomeRun app is more correct. I guess I could also check my schedules direct stuff and see if it is similarly affected.
If it would help, I can send you a copy of the SQLite tool that has the necessary options enabled and you can use it to query the PVR database file to check what it got from XMLTV as well. I wasn't able to pull the XMLTV from something like wget or cURL, I think it was that I didn't specify a User-Agent. Grabbing from a browser and (obviously) from my code works fine. In Chromium Edge, I hit the URL, and once I see anything I do a save page. The browser window ultimately times out, it's too much data for it, but the .xmltv file itself saves off just fine.

LMK if you want SQLite to query the database directly. The PVR addon module also acts as a standalone SQLite extension module, you can load it into SQLite and gain access to all it's goodies, including the query that goes and gets the XMLTV. It will use the User-Agent string for this project, so don't abuse it though - that's how we got where we are! LOL

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

signcarver wrote:
Sun Dec 15, 2019 10:18 am
I do think it would be nice for SD to give the 4 hour guide to those without dvr but I can understand them wanting to get people to pay for guide as the data isn't free. It would be nice of them to say yes they will continue to support that and a "final" non-dvr version released to support such.

With grid guide, I have easily noticed some discrepancies between the two... for instance 5, 1005 (cable) and 5.1(ota) should have the same programming and for the most part they do... and 5 should always match 1005 but in this case on 5 they cut short nfl today by 15 minutes and added a couple of movies and lasts over where there should be infomercials before the later nfl game when the schedule resumes properly. Also I have an OTA channel 10.2 that should match 10, 1010, and 10.1 as it is an SD version of 10.1 and the grid guide showed a movie on during the Fox pregame show. I'm probably am going to need a refresher of getting the xml data (been using json for far too long) as it always seems to time out for me prior to being able to use it so I can't easily check if this might be a case of extra erratic data being added that somehow gets added back into the grid overriding the real data. All I know is that the data in the HDHomeRun app is more correct. I guess I could also check my schedules direct stuff and see if it is similarly affected.
Re-reply to my reply with different info. The trick is that the backend only supports clients that have GZIP encoding enabled. There is usually a command-line option for things like cURL (--compressed, I believe). That's why it works from a Chromium browser, and I never noticed it was required from my code since I had already GZIP-enabled it for all API requests before starting on XMLTV. Offer to share the SQLite method and let you have at my PVR's database file is always good, just say the word. It's actually a lot of fun to play with that way.

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

djp952 wrote:
Sat Dec 14, 2019 6:51 pm
jaytaylor@gmail.com wrote:
Mon Dec 09, 2019 8:11 pm
Awesome. Thank you so much for continuing to look into it! :D
In the meantime, what do you think about me uninstalling the record engine from the local computer that's currently running everything and installing it on the server across the house? If you're on the right track, maybe that would build in the latency or slow things down just enough? That seems to be the more common setup, right? A server or NAS running the RECORD engine...
Hi Jay! I haven't forgotten about you my friend. I set up a local RECORD instance on my Windows box today and ran through lots of Live TV and some Recorded TV from a local instance of Leia in the debugger. Unfortunately, I didn't find anything I was hoping/expecting to.

I had forgotten about the last time I refactored the streaming that pretty much made my "big ol' buffer" pointless. The latest incarnation of things barely uses the buffer at all, at no point was it ever more than about 18K full (out of 1MB), so the idea that it may be filling up and pausing too much was completely incorrect. The data comes in at the same rate whether it's local or remote, the HTTP library seems to behave identically. I was curious if there was some optimization in there if it knew the server was local, but it all looks fine.

I was able to semi-duplicate the problem one time, but it was when I stopped a Live TV stream (Live TV is still buffered on the local disk by RECORD - enables timeshifting). I got Kodi to freak out with the "stream stalled" and all the audio sync errors and eventually it locked up. The point where it locked up wasn't in the PVR code and I wasn't set up to debug Kodi itself, so I missed out on exactly where. I did have some stream debugging in place and it never noted a failure to read the data from RECORD or any zero-length reads, so that event ended up being a bust on me.

I've added this problem to the "Development Backlog" (post #3 or #4 of this thread). I'm ~90% certain based on what you've provided so far that the problem is mine to solve, and once this EPG debacle is out of the way it's my top priority. I stumble my way into finding just about everything eventually. I apologize that the next version needs to go out ASAP (tonight) and it won't have anything in it to solve your problem.
And another reply to a reply, but this time with some actual info. This happened to me today on our main HTPC. Three times, in fact. Sudden stop, then the buffering circle then a wild ride watching Kodi try to catch back up. The problem here was the RECORD engine needed to be bounced. It hasn't been working quite right since I had the second one set up to play with this.

My RECORD engine didn't log any failures either, but my Kodi logs made things a little clearer. What happened to me was something I thought was pretty "normal", since it always happens at least once when starting a stream - the "timeout waiting for renderer" message. One or two timeouts is no big deal, but I had a ton of them in a row, like 150 of them.

That message seems to occur when the Kodi videoplayer can't generate a frame in time (50ms, I believe). With a PVR like this I figure that must be data starvation. So I looked at the code again (and again), and while I don't see any defect, per-se, the current streaming code only reads as much data from the stream as is necessary to fulfill the request and returns it, leaving anything left over in the buffer for the next read, but it's typically not much. Rather recently, I found that if I told Kodi to always expect "up to 32K" of data with every read, I could pretty much dump whatever I have to Kodi every single time.

Here's where my head is at -- this all leaves zero wiggle room for any type of momentary or otherwise short duration stream problem. Kodi is always getting the data as it comes in, and I'm not doing anything anymore to read ahead whenever possible. The old old way (like v1.x way) did all this on a worker thread, so it was always running pumping data into the buffer. That was over-engineered and caused large problems on lower end devices like FireSticks. The new way seems to work about 99% of the time, I really haven't had many complaints at all, but I can see this potential for fragility that doesn't need to be there.

So I *think* the trick is going to be to allow that "big ol' buffer" to fill up more if possible. I have an idea for a low-impact way of doing this that would only kick in if the system is able to read more data than it needs, but it's a little complicated. First I think I'll try something simple like "read as much as you can in 25 milliseconds before sending back the data" and see how that affects the buffer for HD streams. If more data can be buffered without playback performance problems (and without doing it on a thread again) it should smooth out any transient events.

Yeah, I type a lot. It's my thing :)

jaytaylor@gmail.com
Posts: 5
Joined: Sun Dec 08, 2019 6:23 am

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by jaytaylor@gmail.com »

I really appreciate the effort --and don't sweat it, I feel like I'm usually the one writing too much :)
I did go ahead and uninstall the RECORD engine from the local machine and set it up on the server across the house. Seems like the same or similar sort of hitches in the stream... playing then short second or two halts in the stream. I didn't get any logs this time, but I can get more if you feel like they'd be of any use... I can get ya any information you need. Just let me know!

ddejager
Posts: 131
Joined: Tue May 06, 2014 2:26 pm
Location: Glen Arbor, MI

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by ddejager »

Yeah, I type a lot. It's my thing :)
Its a good thing! Thanks for all your careful attention.

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

jaytaylor@gmail.com wrote:
Mon Dec 16, 2019 8:45 am
I really appreciate the effort --and don't sweat it, I feel like I'm usually the one writing too much :)
I did go ahead and uninstall the RECORD engine from the local machine and set it up on the server across the house. Seems like the same or similar sort of hitches in the stream... playing then short second or two halts in the stream. I didn't get any logs this time, but I can get more if you feel like they'd be of any use... I can get ya any information you need. Just let me know!
If you're game, I have something you can try as an experiment. I changed things around a bit to much more aggressively read ahead on the stream when possible (mostly will have effect for high bandwidth streams like HD). If by some miracle this solves your problem, it would need additional work before being a formal change, but I would love to know if this works better for you.

If it makes things worse, you can easily go back to 3.0.0 by clicking the Update button in the Kodi addon settings. It will re-download and install the prior version for you automagically. I numbered this as 3.0.1~alpha1.

Link to zip file (OneDrive): https://1drv.ms/u/s!AgEGEEVzGNq-jIhz2jF ... A?e=Va6Sgc
[Leia / Windows x64 build only]

Details:

Currently I try to get data back to Kodi as fast as possible, so I only read from the input stream long enough to satisfy the request. This changes things a little to read from the stream like before, but then wait 5 milliseconds and read again if there is anything there. The net effect is that the buffer will fill up when Kodi asks for less data than is available. The "Stream Chunk Size" setting has a big impact on this as well, using 16KiB or more chunks negates the effort, so I recommend leaving that at the default 4K.

If this solves anything (50/50 on that), I would need to add some additional smarts to it to only do the subsequent read if the buffer has space for it, perhaps only do it if there is 25% of the buffer left or something. I want to avoid the constant pause/resume that occurs when the buffer gets loaded up. It doesn't seem to have any appreciable impact to anything on Windows, I worry more about the lower-end devices like RPis and FireSticks where this wastefulness might not go unnoticed :)

Anyway, give it a shot if you want, I'll be testing it here as well. If you don't see any difference or it makes things worse, that's great information to have as well. Take your time as well, no hurry. Don't miss any holiday specials to test it! :mrgreen: <-- Grinch?

jaytaylor@gmail.com
Posts: 5
Joined: Sun Dec 08, 2019 6:23 am

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by jaytaylor@gmail.com »

Absolutely. I'll give it a try!
It might take me a day or two, but I definitely will.
Should I try both local RECORD and RECORD on the networked server?
Will you want the Kodi and the HDHomerun logs too?

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

jaytaylor@gmail.com wrote:
Mon Dec 16, 2019 11:10 am
Absolutely. I'll give it a try!
It might take me a day or two, but I definitely will.
Should I try both local RECORD and RECORD on the networked server?
Will you want the Kodi and the HDHomerun logs too?
Either way works - since both install types gave you the same problem I'd say whichever setup you would prefer :)

Logs aren't necessary, but I appreciate the offer. If this works any better, it will just remove the log entries anyway, it shouldn't add anything new. You'll know based on just observation if it's a step in the right direction or not. Hoping it is!

My next step is to run a program here that screws up the network randomly and see if I can get the existing one to more reliably exhibit the problem, and then can have some evidence if this might be a good way to solve that. It's so hard to make happen on demand!

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by signcarver »

I probably won't have time to look at it until after the holidays but I do want to look into the xml guide data a bit more as I needed to quickly add a couple of Christmas specials last night and a chrome update further crippled my previous web based project (though it could have also been somewhat coupled by a change on sd's servers)... I needed to select Charlie Brown(7:00), Olaf(approx 8:00), and Shrek(8:30) only to find the following: Needed channel 15/15.1

Image

(For those not getting image, channel 15.1 had Charlie Brown starting about 7:30 instead of 7 but then Hell Fest from 8-9, Channel 15 had FightClub until 8:20 but did list Olaf and then Shrek at 8:30)

It may be my unfamiliarity with your addon but I wanted these to record from a quatro which would be preferred without ChannelOnly (15.1, which wasn't showing olaf or shrek) but it seemed like ChannelOnly rules were being created when I manually pulled up tasks afterwards (and check that engine got them) so what I thought would be quick made me have to run a utility I made that resets all ChannelOnly rules to "null" (funny the recordings also appeared at top as if DateTimeOnly was also set but that didn't get returned to me when I looked at the rule and when I reset ChannelOnly they went to being "normal" and not at top of priority)

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

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 »

signcarver wrote:
Wed Dec 18, 2019 12:05 pm
I probably won't have time to look at it until after the holidays but I do want to look into the xml guide data a bit more as I needed to quickly add a couple of Christmas specials last night and a chrome update further crippled my previous web based project (though it could have also been somewhat coupled by a change on sd's servers)... I needed to select Charlie Brown(7:00), Olaf(approx 8:00), and Shrek(8:30) only to find the following: Needed channel 15/15.1

(For those not getting image, channel 15.1 had Charlie Brown starting about 7:30 instead of 7 but then Hell Fest from 8-9, Channel 15 had FightClub until 8:20 but did list Olaf and then Shrek at 8:30)

It may be my unfamiliarity with your addon but I wanted these to record from a quatro which would be preferred without ChannelOnly (15.1, which wasn't showing olaf or shrek) but it seemed like ChannelOnly rules were being created when I manually pulled up tasks afterwards (and check that engine got them) so what I thought would be quick made me have to run a utility I made that resets all ChannelOnly rules to "null" (funny the recordings also appeared at top as if DateTimeOnly was also set but that didn't get returned to me when I looked at the rule and when I reset ChannelOnly they went to being "normal" and not at top of priority)
Not sure about the listings themselves, I haven't seen anything like that here but I will check. So far my ATSC and QAM channels that happen to be the same line up. Have you been able to check the Schedules Direct listings for KNXVDT? I'm also happy to look at it here, but I would need a copy of the PVR database (which is now very large, mine is like 18MB). It's very possible that there is a logic error in how I'm matching up the channels in the XMLTV, although I was careful to verify ATSC stuff matches properly, I've bungled that once before.

When using the EPG to schedule a recording, the default is channel only if you pick "Record". To change it to an "Any Channel" timer, instead select "Add Timer". Ensure "Record Series" is set instead of "Record Once", then change channel to "Any Channel". Record Series creates a normal series rule on the back end, Record Once creates a date/time only rule on the backend, so a channel must be selected.

(Not sure this image will show up ...)

Image Image

The recording rules can also be edited (to the extent the Kodi UI lets me) via the "Timer Rules" area in Kodi. "Timers" are read-only and not 100% accurate, this is the list of things in the backend comes back with "RecordingRule:1" in the JSON. You can't change the Timer Rule type (Record Series vs. Record Once), but you can edit the channel, padding, etc.

Post Reply