This simple script parses EPG data from the service at horizon.tv (which is used by a product sold by a digital cable provider in the Netherlands). The original data is formatted JSON. This script translated that to the XMLTV format and passes that to TVHeadend using the 'external grabber' interface. This interface is a Unix socket which is read by TVHeadend.
You should select the channels by modifying the script a bit. Note that channel display names have to match the ones in your TVHeadend configuration for this to work. There is a variable called add_display_name in the XMLTVDocument class to help with remapping. Setting this to:
add_display_name = {'NPO 1 HD': ['NPO 1']}
remappes NPO 1 HD to NPO 1. Note that although multiple display names are supported by XMLTV this is not the case for TVHeadend.
Configuration of the wanted channels is done by adding and removing channels to the wanted_channels list. A preliminary list is available by default.
Execute
$ python horepg.py
as the user you are running TVHeadend as. This is probably the hts user.
This could use a daemon mode, while being able to drop privileges to that of the hts user. A systemd service file (or upstart) would be nice. It would be nice to stop the whole reconnecting for each channel thingy. Maybe this should be a proper xmltv parser.