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:
- 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).
- 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)
- In KODI, go configure Tvheanend Server 4.2 addon
- Set XMLTV source type to FILE
- Set XMLTV File location to the location of the downloaded script (eg /storage/.config hdhomerun.xml)
- In Tvheadend web interface (eg http://<LIBREELEC_IP>:9981/)
- Config / General / Image Cache : mark it enabled (to cache the channel icons locally)
- Config / Channel/EPG / EPG Grabber : ensure "Update channel icon" is checked
- Config / Channel/EPG / EPG Grabber Modules :
- make sure Internal XMLTV is enabled.
- (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)
- click "Re-run Internal EPG Grabbers" and ensure it completes (journalctl -u service.tvheadend42.service -f might be useful)
- 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)
- 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)
- In KODI, force refresh of the guide content and channel icons
- Settings / PVR & Live TV : Clear data
That's it, you should now have icons and guide coming from hdhomerun!