Tvheadend EPG guide from hdhomerun

  • Hello,


    I was looking to have the EPG guide provided by hdhomerun into tvheadend, including the channel icons. So I ended up creating a python script to do it. As it may be of interest to some of you, I decided to share it on this forum.


    Basically, the script generate a XMLTV compliant file which can then be read by the internal XMLTV grabber. It is the same kind of file generated by WebGrab+Plus.


    The xml file is generated from the Silicon Dust API linked to your hdhomerun device. It means that you need a hdhomerun device to use the script.


    The main steps to make it work are:

    1. Download hdhomerun.py.txt and rename it to hdhomerun.py. Let's say you download it to /storage/.config (or \\<LIBREELEC_IP>\Configfiles if using SMB).
    2. Connect to your libreelec by ssh and run :python /storage/.config/hdhomerun.py. This will generate a hdhomerun.xml file.
      (start the script in a cron to update the guide content on a regular basis)
    3. In KODI, go configure Tvheanend Server 4.2 addon
      1. Set XMLTV source type to FILE
      2. Set XMLTV File location to the location of the downloaded script (eg /storage/.config hdhomerun.xml)
    4. In Tvheadend web interface (eg http://<LIBREELEC_IP>:9981/)
      1. Config / General / Image Cache : mark it enabled (to cache the channel icons locally)
      2. Config / Channel/EPG / EPG Grabber : ensure "Update channel icon" is checked
      3. Config / Channel/EPG / EPG Grabber Modules :
        1. make sure Internal XMLTV is enabled.
        2. (You can also set "Channel numbers" to Only digits to automatically map EPG to the channels according to their numbers. In my case it is not working and I really don't understand why, even after reviewing the source code of xmltv module of tvheadend)
        3. click "Re-run Internal EPG Grabbers" and ensure it completes (journalctl -u service.tvheadend42.service -f might be useful)
      4. Config / Channel/EPG / EPG Grabber Channels : Ensure that your channels are correctly mapped (as auto mapping on the channel number doesn't seem to work)
      5. Config / Channel/EPG / EPG Grabber Modules : click "Re-run Internal EPG Grabbers" one last time (first time is for channel mapping, now this is for EPG content)
    5. In KODI, force refresh of the guide content and channel icons
      1. Settings / PVR & Live TV : Clear data

    That's it, you should now have icons and guide coming from hdhomerun!

  • Hi jefflessard.


    Thanks a lot for that info. I was able to have my EPG loaded with data from my HDHomeRun. I'm not that so verse on cron / linux / etc. Can you guide me on creating the cron for updating/creating that file nightly?

  • Works great!! Thank you very much. I am going to try and recode the xml to conform to DTD in the hopes that the Episode numbers will import. Thanks again