[mythtvnz] No EPG, what am i doing wrong

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Apr 9 10:50:18 BST 2022


On Sat, 9 Apr 2022 20:00:31 +1200, you wrote:

>Almost success!
>
>I updated the xmltv ID's in mythtv-setup's channel editor - you were
>right - several were missing / out of date. I used your 'source1.txt'
>as a reference.
>
>I then managed to get mhegepgsnoop.py working - turned out I didn't
>have my sql database password correct (sigh).
>
>A "tvguide.xml" file was generated, and successfully imported all data
>into mythtv's guide with mythfilldatabase - yay!
>
>The next piece was using do_mhegepgsnoop2.sh to run processing with
>xmltv-proc-nz.
>
>Running do_mhegepgsnoop2.sh, I get a 'listings-mheg5.xml.gz' file in
>'/var/www/html/epg', but as it's been gzipped, the script fails with
>"chmod: cannot access '/var/www/html/epg/listings-mheg5.xml': No such
>file or directory".
>
>I see the do_mhegepgsnoop2. sh script runs 'gzip $OUTPUT_FILE'. If I
>comment out this line, it appears to run, finishing with "Running
>xmltv-proc-nz on the MHEG5 data", but then it leaves the
>'listings-mheg5.xml file unzipped, which is fine, because
>mythfilldatabase can use that as its source file directly.
>
>Thanks Stephen!

Yes, the gzipped file is if you are using tv_grab_nz-py to download it
from your web server.  That expects a gzipped file and unpacks it. You
are directly running mythfilldatabase, so you need the non-gzipped
.xml file.

The chmod error is a bug on my part.  When I added the gzip command, I
forgot to change the file name for chmod also.  I have updated
do_mhegepgsnoop2.sh on my web server.  In your case, you have now
commented out the gzip line so you do not need to change the chmod
line.  So it is now working properly for you.

So all you need to do now is to schedule do_mhegepgsnoop2.sh to be run
at least daily.  It is best to do that at a time when MythTV is less
likely to be starting a recording, so I do it at 10 past the hour.  At
present I am running my EPG updates at 15:10 each day.  You can do
that by just adding a line to /etc/crontab, or if you want to do it
the right way these days and use systemd, you can create two systemd
units in /etc/systemd/system to do it:

File /etc/systemd/system/epg.service:

[Unit]
Description=Get MHEG5 EPG for MythTV
After=mythtv-backend.service

[Service]
ExecStart=/bin/bash -c "/usr/local/bin/do_mhegepgsnoop2.sh"

[Install]
WantedBy=multi-user.target


File /etc/systemd/system/epg.timer:

[Unit]
Description=Get MHEG5 EPG for MythTV daily at 15:10

[Timer]
OnCalendar=15:10:00
Persistent=true

[Install]
WantedBy=timers.target


Make both files chown root:root and chmod u=rw,g=r,o=r.  Then run
these commands:

sudo systemctl daemon-reload
sudo systemctl enable epg.timer

Do not do systemctl enable epg.service - if you do that, the EPG will
be run every time the PC is booted, rather than just at the right
time.  If you want to manually run the EPG, do this:

sudo systemctl start epg

That will run epg.service once.  To see the log output from
epg.service, run:

sudo journalctl -eu epg

It will also be logged to /var/log/syslog.



More information about the mythtvnz mailing list