[mythtvnz] No EPG - need temp solution

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Apr 14 12:02:33 BST 2022


On Thu, 14 Apr 2022 09:29:44 +1200, you wrote:

>I do not fully understand how XMLTV works and do not feel confident to 
>get it working with the recent grabbers being discussed on this thread.
>
>I wonder if a "how-to" could be created similar to the notes I made when 
>I first set up my system to use Had's grabber?
>
>Here are my original notes:-
>
>1) Download tv_grab_nz-py from http://nice.net.nz/tv_grab_nz-py/
>
>2) Copy tv_grab_nz-py to /usr/local/bin.  Make sure that it
>is executable. (sudo chmod +x tv_grab_nz-py)
>
>3) Configure it. Note that the configuration file name must match that
>name of the video source configured in mythtv-setup for the
>mythbackend/mythfilldatabase to use this grabber.
>tv_grab_nz-py –configure –config-file ~/.mythtv/<video sources
>name>.xmltv
>Step 3 had some problems for me but it was overcome by copying and editing
>another <video sources name>.xmltv
>
>You also need to symlink otherwise mythfilldatabase will not work
>automatically (it uses the user mythtv)
>sudo ln -s /home/yourusername/.mythtv/Freeview.xmltv 
>/home/mythtv/.mythtv/Freeview.xmltv
>
>4) To see if the xmltv side of things works run
>tv_find_grabbers
>
>This should return a list of all the installed grabbers, which should
>include tv_grab_nz-py.
>
>5) To see if the myth side of things works run
>mythfilldatabase
>Pay close attention to the output of this. If it looks like it worked,
>the MythWeb status page should also show a successful run.
>
>6) On the master backend run mythsetup and
>a) In Video Sources set “New Zealand (py)” as the grabber for your
>Video Source.
>b) In General, on the Mythfilldatabase page (its the last page) enable
>“Automatically run mythfilldatabase”. Configure time, frequency, etc
>to suite. Now Myth should use tv_grab_nz-py to update EPG
>periodically. The MythWeb status page shows when it was last run and
>what the results were.

Using mhegepgsnoop.py is a bit different.  You can still use
tv_grab_nz-py if you want to, but it is probably easier not to.  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
mythtv-setup.

Then run these commands:

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/mhegepgsnoop-0.7.2.py
mv -v mhegepgsnoop-0.7.2.py mhegepgsnoop.py
wget http://www.jsw.gen.nz/mythtv/do_mhegepgsnoop3.sh
wget http://www.jsw.gen.nz/mythtv/xmltv-proc-nz
mv -v do_mhegepgsnoop3.sh do_mhegepgsnoop.sh
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 do_mhegepgsnoop.sh (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
sourceid;
quit

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

mysql mythconverg
select
cardid,parentid,videodevice,cardtype,inputname,sourceid,displayname,schedorder,livetvorder
from capturecard order by videodevice,cardid;
quit

Now continue running these commands as root:

cd /usr/local/bin
chmod u=rwx,g=rx,o=rx mhegepgsnoop.py do_mhegepgsnoop.sh
chmod u=rwx,g=rx,o=rx xmltv-proc-nz
cd /var/www/html
wget http://www.jsw.gen.nz/mythtv/xmltv-proc-nz-json.tgz
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;
quit

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
file.

Now continue running these commands as root:

cd /etc/systemd/system
wget http://www.jsw.gen.nz/mythtv/epg.service
wget http://www.jsw.gen.nz/mythtv/epg.timer

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
mythfilldatabase.

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
exit

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 do_mhegepgsnoop.sh, mhegepgsnoop.py, xmltv-proc-nz and
mythfilldatabase:

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:

/home/mythtv/.mythtv/freeview.xml

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:

TEMP_FILE=/home/mythtv/.mythtv/freeview-raw.xml

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.



More information about the mythtvnz mailing list