Mailing List Archive

EPG Using success
I want to express my thanks and praise to Stephen Worthington for the
work recently done,

firstly by creating a "how-to" to set up his (copied
below into this post)

and secondly helping me to sort out why it wasn't quite working
correctly on my system.

(I will leave it to Stephen to decide if he wants to publish the two
tweaks I needed to make it work properly)

The big advantage to using this method is that 3rd Party EPG sources are
not permanently reliable.



So here is a full set of instructions (I hope) for getting set up to use
mhepgsnoop and xmltv-proc-nz.

In mythtv-setup, select "No grabber" for the EPG source and disable
EIT. Disable the automatic running of mythfilldatabase. Note down
the time you currently have mythfilldatabase running at. Exit

Then run these commands:

sudo su
cd /usr/local/bin
mv -v
mv -v
mkdir -p /home/mythtv/.mythtv
chown mythtv:mythtv /home/mythtv/.mythtv

Ignore any error or warning messages that occur in the last two
commands above if you already have a .mythtv directory.

Now edit (as root) and check the configuration at
the top of the file. The SOURCEID needs to be set to the sourceid of
your FreeviewHD DVB-T channels, and the ADAPTER needs to be set to the
adapter number (the x in /dev/dvb/adapter<x>) of one of your DVB-T(2)
adapters. It is probably best to choose the one that is used least
often, which will normally be the one with the highest number, but it
depends on how you have your tuner priority and schedorder values set
up. Of course, if you have a spare tuner not being used (ie > 5
DVB-T(2) tuners), select that to be used for mhegepgsnoop.

These commands will show you your sourceid values:

mysql mythconverg
select sourceid,name,xmltvgrabber,useeit from videosource order by

And these commands should show you the tuners configured in MythTV:

mysql mythconverg
from capturecard order by videodevice,cardid;

Now continue running these commands as root:

cd /usr/local/bin
chmod u=rwx,g=rx,o=rx
chmod u=rwx,g=rx,o=rx xmltv-proc-nz
cd /var/www/html
tar xvf xmltv-proc-nz-json.tgz

Now check the three +json files in the subdirectories under the
/var/www/html/json directory. Make sure they are using the same
xmltvid values that you have on your system. These commands will
show your current xmltvid values:

mysql mythconverg
select chanid,channum,name,callsign,xmltvid,serviceid from channel
where sourceid=<x> order by channum+0;

Replace <x> with the correct sourceid. If your xmltvid values are
different from the +json ones, you can choose to change either the
ones in the channel table, or the ones in the +json files, so that
they match. If you are not using Sky EPG as well as FreeviewHD EPG,
you can ignore the xmltvid values in the sky-movies-xmltvids/+json

Now continue running these commands as root:

cd /etc/systemd/system

Now you need to edit the epg.timer file and change the two places
where it says "15:10" to be whatever time you normally run

Now continue running these commands as root:

cd /etc/systemd/system
chmod u=rw,g=r,o=r epg.service epg.timer
systemctl daemon-reload
systemctl enable epg.timer

At this point everything should be set up and EPG will be
automatically downloaded from MHEG5, processed by xmltv-proc-nz and
loaded into the database by mythfilldatabase, at the time specified.

To test if it is working, or if you ever want to run EPG collection
manually for some reason, do this:

sudo systemctl start epg

To see the status of EPG collection, this command will show you when
the next automatic EPG collection will be done:

systemctl status epg.timer

and this will show you the result of the last EPG run:

systemctl status epg

and this will show you the full output from epg.service, including the
full output of,, xmltv-proc-nz and

journalctl -eu epg

You will be in a "less" command showing the end of the systemd journal
for epg.service - page up to see more.

Should you want to check it, the last downloaded EPG will always be
stored here:


This is the version after xmltv-proc-nz processing. If you also want
to keep a copy of the raw MHEG5 data as downloaded, edit
do_mhegepgsnoop and change the TEMP_FILE= line to:


Or you can just look at the /tmp/xmltv.xml file (if you have not
rebooted since EPG was last run.

I do not have a system I can test the above on, so please let me know
if I have done a typo somewhere or if something does not work.

mythtvnz mailing list