Please read the Status Report Forum!

Use our own app called EPiG to get full EPG without needing an XML! You find it in your profile!

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TVheadend EPG

I've recently started using TVheadend, I'm a complete noob (with tvheadend, I'm pretty good with linux) and not sure how to get IPTV-EPG working.

I cant get the EPG Grabber working for my playlist. Looks like you need a script and a cron job.

Does anyone have TVheadend set up and working and can help me?


Easiest way to do it

create a file in /usr/bin/ called tv_grab_iptv-epg

nano /usr/bin/tv_grab_iptv-epg

Paste this script and edit <url> with your EPG url

if (( $# < 1 ))
       # <url> = your full EPG url
       wget -q -O - <url>
 exit 0

for arg
   case "$arg" in
   #translate --gnu-long-options to -g (short options)
      --description) args="${args}-d ";;
      --version) args="${args}-v ";;
      --capabilities) args="${args}-c ";;
      #pass through anything else
      *) [[ "${arg:0:1}" == "-" ]] || delim="\""
          args="${args}${delim}${arg}${delim} ";;

#Reset the positional parameters to the short options                                                                                                                                                                                        eval set -- $args                                                                                                                                                                                                                                                                                                                                                                                                                                                                         while getopts "dvc" option
   case $option in
       d)  dflag=1;;
       v)  vflag=1;;
       c)  cflag=1;;
       \?) printf "unknown option: -%s\n" $OPTARG
           printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
           exit 2
   esac >&2

if [ "$dflag" ]
  printf "tv_grab_iptv-epg is a simple grabber that just reads the EPG provided by\n"
if [ "$vflag" ]
  printf "0.1\n"
if [ "$cflag" ]
  printf "baseline\n"

exit 0

This can also be done for any additional EPG urls/sources you have.

Restart TVHeadEnd and find/enable the module
[Image: nme0k127.png]
Hi folks,

I feel your pain in getting TV Headend working with EPG updates. I've been battling this for a loooooong time and finally have been successful. 

The approach I describe here is slightly different to the one above and uses the standard TVHeadend External XMLTV EPG grabber listed in the TVHeadEnd grabber page. The XMLTV EPG data is downloaded using a script, the script collects the EPG data and sends it to the TVHeadend Linux socket named xmltv.sock that is provided by the standard "External: XMLTV" grabber.

The EPG update script is executed every day based on a scheduled task running on the same system as TVHeadend is running on. (Linux Sockets can only send and receive data between programs running on the same system).

You've most likely been successful with the first part, ensuring the services in the M3U have been mapped in TVH:

  1. Create the IPTV Network and give it a friendly name such as “UK IPTV”
  2. Check the “Create Bouquet” option so that you can automatically map the offered services to channels via selection of the bouquet.
Set the number of input streams based on your available bandwidth (I have 4 streams i.e: 1 watching, 3 recording).
  4. As soon as “Create” is clicked, the services offered will be scanned. They can be rescanned by clicking the Force Scan button if necessary.
  5. Wait until #Muxes = #Services
  6. If you are using the bouquet to map the services to channels, in the Configuration > Channel > EPG > Bouquet’s dialog, enable the bouquet for the network you created to automatically map the services to channels
Note that channels will not be visible in the Configuration > Channel / EPG > Channels dialog until mapping has been done!

With the IP Channels mapped now configure the EPG Grabber as follows:

  1. In the Tvheadend admin interface: Configuration > Channel / EPG / EPG Grabber Modules menu, enable the “External: XMLTV” grabber. This will be used to receive XMLTV EPG data via a script - All other grabbers that are not used can be disabled.
  2. In the EPG Grabbers dialog, note the path to xmltv.sock listed in the External: XMLTV" grabber settings (it will be grey and not possible to change it)
  3. Create the script file based on the code below replacing...{your-egg-best-filename} with the filename EPG-best have provided to you and...replacing {your path to xmltv.sock} with the path you noted from your installation of TVHeadend.
  4. Save the script as epgbest_to_xmlsock
  5. Create a Scheduled Task to execute the script every day at 03:00
#!/bin/sh -v

XML=$(mktemp -u)
SOCKET="/{your path to xmltv.sock}/xmltv.sock"

curl -so $XML $URL

if gzip -t $XML; then
       zcat $XML | socat -dd stdin UNIX-CONNECT:$SOCKET


rm $XML

Note that my installation was on a Synology running DSM6.0, I didn't need to change permissions for the script to be executable - your Linux installation may require that (I'm not a Linux expert).

After the first setup of the grabber, two manual executions of the script are required:
  • The first run will collect channels and populate the EPG Grabber Channels dialog.
  • The second run will collect broadcasts associated with the channels and populate the Electronic Program Guide.
Hope others find this useful.

Forum Jump:

Users browsing this thread: 1 Guest(s)