Crude XMLTV Export

of course the XMLTV format is readily available, but the source code for the grabbers is too? where?

that's why i said if i am missing something completely obvious please help me out...

yeah you beat me to it. i was editing my post, i didn't realize the grabbers were in there.

thanks. definitely a valid way to go if you're proficient in perl.

The main repository of the XMLTV project is hosted at Sourceforge, but can also be found on GitHub. The tv_grab_zz_sdjson grabber is a part of the XMLTV project, and can be found in those repositories.

The tv_grab_zz_sdjson_sqlite grabber is hosted separately on GitHub, and can be found here. (The author of this particular grabber can often be found on the SiliconDust forums under the handle gtb.)

Also, if you're curious about the actual XMLTV format, the you can view the DTD on GitHub.

(Edit: It looks like tv_grab_zz_sdjson_sqlite has been merged into the XMLTV project, as both grabbers are present in the grab subdirectory in the main repo.)

You modify the grabber, so that instead of querying the Schedules Direct servers, you point it to the endpoint of your own Channels DVR server.

yeah, scroll up a bit. @coolmaui pointed me in the right direction.

the XMLTV format was never an issue. i had been using that while developing my own parser. the part i missed was that they had the code for the grabbers up there too. i don't know how much they would have helped me, as it was pretty easy to just pick apart the json itself and apply it to the XMLTV output, but definitely could be helpful to someone else trying to do this if they have perl experience.

New in v2020.12.10.0059

3 Likes

will that work with any duration or only an hour?

Why would it be a parameter if it only worked with one value? :grinning:

2 Likes

i figured that was the answer, just wanted to make sure :slight_smile:

Much better than “?givemeanhourofxml=1”. :grin:

1 Like

Well, considering the /devices/…/guide endpoint is already accepting the duration parameter from Channels' own native clients, it makes sense that the /devices/…/guide/xmltv endpoint would accept the same parameters.

Both endpoints also take a time= parameter which accepts a unix timestamp

1 Like

This is a great feature.
I must be doing something wrong though. I am only getting listings for the first few channels. What am I missing?

Changing /ANY/ - to a specific device/source seems to be working as I would expect.

Edit: Maybe not. I am only seeing data for up to channel 7.1 on each of my HDHR tuners. TVE seems to be working as expected.

It looks like to me the practical limit on this (at least running Channels on a Pi4) is about a day's worth of data. I tried loading three days of data, and the connection timed out.

I use Channels as a source for NextPVR (so I can get my TVE channels into NextPVR), and right now I just use Schedules Direct for the data on those channels. It works, but if I import a new Channel into NextPVR then I have to reset all the guide data mapping. And I have to have a combination of east coast and west coast SD sources to deal with feeds that are for time zones I'm not in. I was hoping to use the XMLTV feed to replace the SD stuff (as that doesn't get overwritten when I update channels), but that won't work for me if I can only get a day of data. Ideally I'd be able to get 14 days to match what I get from SD.

I believe Channels' own clients request the guide data in 6 hour chunks. (Although, I could be mistaken and it might be 4, 8, or 12 hours. In any case, each grab is less than a day.) As Aman mentioned, use the duration parameter in conjunction with the time parameter.

(The date command can be your friend for converting human-readable dates into epoch time. For example, to retrieve a 6 hour chunk of data beginning on Friday at 9:00 am:

curl -sSL "http://${DVR}:8089/devices/ANY/guide/xmltv?time=$(date -d 'Friday 9:00 am' +%s)&duration=21600" > guide.xml

where DVR is the IP address of your DVR server.)

2 Likes

I used a duration of 1209600 for 14 days, and worked fine for me.

Hmmm. Looks like some odd Firefox issue. If I use the mDNS name for my Channels setup (channels.local) with the URL and 14 days of data it works. If I use the IP address, it times out. IP address works fine in Microsoft Edge. So I guess I can do what I want. Just need to find time to make the changes.

If we have multiple M3U sources defined are we supposed to be able to get the XMLTV output for each source separately?
I am using:
http://x.x.x.x:8089/devices/M3U-source2/guide/xmltv?duration=604800
The output is valid and contains data but for all M3U sources.

Thank You