XMLTV guide data

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Ekstir
Posts: 2
Joined: Tue Feb 11, 2020 11:49 pm

Re: XMLTV guide data

Post by Ekstir »

nickk wrote:
Thu Nov 28, 2019 10:13 am
We are testing a new service providing 14-day XMLTV format guide data to customers who are paying for the HDHomeRun guide.

API: https://api.hdhomerun.com/api/xmltv?DeviceAuth=xxx

DeviceAuth comes from the HDHomeRun unit - for coding you get it from discover but for testing the easiest is to get it from
http://<ip of hdhomerun>/discover.json
If you have more than one HDHomeRun unit pull the DeviceAuth from each and concatenate them together.

The API will return the set of all channels across HDHomeRun units. For example if you have a HDHomeRun unit for cable and a HDHomeRun unit for antenna the API will return 14-day guide for all cable and antenna channels combined.

The API works in all supported countries.

Nick
Is this service also available in EUR?

nickk
Silicondust
Posts: 15857
Joined: Tue Jan 13, 2004 9:39 am

Re: XMLTV guide data

Post by nickk »

Ekstir wrote:
Wed Feb 12, 2020 2:02 am
Is this service also available in EUR?
We don't have all EU countries but it is available for the EU countries our app has guide data for.

Nick

Ekstir
Posts: 2
Joined: Tue Feb 11, 2020 11:49 pm

Re: XMLTV guide data

Post by Ekstir »

The Netherlands?

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

Re: XMLTV guide data

Post by signcarver »

Launch the hdhomerun app... the guide data is the same, just delivered differently, so if you get guide data there, have a modern tuner, and you subscribe to the dvr service, the xml version of the guide is available.

jasonl
Expert
Posts: 15226
Joined: Sun Oct 28, 2007 9:23 pm

Re: XMLTV guide data

Post by jasonl »

Guide data is available for some Dutch channels but not many: NPO1, 2, and 3 , RTL4, NET5, RTL5, SBS 6, RTL7, RTL8, Eurosport, Eurosport 2, National Geographic, Discovery, and Veronica/Disney XD.

chuckles67
Posts: 92
Joined: Tue Dec 10, 2013 8:38 am

Re: XMLTV guide data

Post by chuckles67 »

gr33k wrote:
Sat Feb 08, 2020 12:08 pm
Ok...so I got it running, but I realized the key is not static...it seems to change after a while (I don't know how long but at least every day if not sooner you will have a newer key). So I had to modify the script to be able to obtain the key first, and then pass it as a variable to the script each time to successfully download the TVGuide data :?

Well - that appears to be easy enough. You need to have an app called jq (https://stedolan.github.io/jq/) installed though. You should be able to apt install jq or yum install jq for an easy install. With that...here we have:

Code: Select all

#!/bin/bash
echo 'Getting Current Key from HDHomeRun...'
KEY=$(curl http://192.168.10.143/discover.json | jq -r .DeviceAuth)
echo 'Current Key is' $KEY #optional
echo 'Downloading TV Guide Data...'
curl --compressed api.hdhomerun.com/api/xmltv?DeviceAuth=$KEY > xmltvlist.xml
echo 'Done!'
Now of course you have to replace 192.168.10.143 with the IP of YOUR HDHomeRun...but that's about it :mrgreen:
Thank you! This was really helpful. I tried this bash script on Mac OS X and, after giving execute permissions using chmod +x <name>, the bash script works fine from terminal :)

On Mac OS X when I tried to run this script using crontab the generated .xml file was empty. The fix for me was to add a PATH= statement to the script like this. On my system jq is in /usr/local/bin, so perhaps that is why an explicit path is needed. I still need to test this through a KEY change.

Code: Select all

#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin  # Fix for crontab.
echo 'Getting Current Key from HDHomeRun...'
KEY=$(curl http://192.168.50.19/discover.json | jq -r .DeviceAuth)
echo 'Current Key is' $KEY #optional
echo 'Downloading TV Guide Data...'
curl --compressed api.hdhomerun.com/api/xmltv?DeviceAuth=$KEY > ~/Downloads/xmltvlist.xml
echo 'Done!'

chuckles67
Posts: 92
Joined: Tue Dec 10, 2013 8:38 am

Re: XMLTV guide data

Post by chuckles67 »

Is it possible to add one extra line for the episode-num system comforming to "xmltv_ns" ?

Example given this:

Code: Select all

<episode-num system="onscreen">S24E76</episode-num>
include one extra line:

Code: Select all

<episode-num system="onscreen">S24E76</episode-num>
<episode-num system="xmltv_ns">23.75.0</episode-num>
See reference: https://github.com/XMLTV/xmltv/blob/master/xmltv.dtd

Thanks.

UPDATE: I've written (or rather hacked :)) a python file to convert the .xml file into a version that includes episode-num "xmltv_ns" lines.

I also added a line to help indicate a show is a repeat. If a show does not contain this "new" line:

Code: Select all

<programme>
     ...
     <new />
     ...
</programme>
then add this line:

Code: Select all

<programme>
     ...
     <previously-shown />
 </programme>

stevedparry
Posts: 1
Joined: Mon May 25, 2020 1:43 pm

Re: XMLTV guide data

Post by stevedparry »

I've just subscribed but im still getting "not subscribed"

NedS
Silicondust
Posts: 1070
Joined: Mon Dec 10, 2018 12:38 pm

Re: XMLTV guide data

Post by NedS »

stevedparry wrote:
Mon May 25, 2020 1:45 pm
I've just subscribed but im still getting "not subscribed"
It sounds like you're the same Steve that filed a support ticket, where we sent you the activation link, but if not, please open a support ticket and I can look into it: https://www.silicondust.com/support/trouble-ticket/

Post Reply