Setting up an EPG for MythTV in New Zealand

One of the most important things to get right for your MythTV installation is the Electronic Program Guide (EPG). The EPG lets MythTV know when all of the programs are on so it know when to record your favourite show like “The Best of Top Gear”.

I’ve been using xmlTVNZ for some months now reasonably successfully. xmlTVNZ is a command line tool that scrapes various web-sites for the TV listings. The specific web-sites that are scraped depend on the command line parameters passed to it, which depend on which channels you are interested in getting EPG data for. Because of it’s scraping nature, it’s prone to falling over when a web-site that it scrapes changes. I think that problem may of occurred last night because all of the TV3 listings going forward disappeared. I managed to eventually get it working again by modifying the command line parameters to scrape TV3 off the Sky web-site instead of XTRA (which now appears to be Yahoo!).

I’ve also belonged to the Myth TV in NZ mailing list for some months and recently there was talk of some other common EPG methods. At the time I didn’t look into it because xmlTVNZ had been working fine. Given the recent problems though I looked into both the “Hairy” and “Nice” EPG listing methods.

The “Hairy” EPG is located at http://hairy.geek.nz/epg/ but when I looked last night there was some other strange directory listing there. The “Nice” EPG is located at http://nice.net.nz/epg/ and was all up when I looked last night. Both the Hairy and Nice EPG’s are based of the DVB program guide broadcast by Sky. The Nice one appears to have at least better information than obtained by xmlTVNZ because after updating there was lots of information updated after running mythfilldatabase for the same number of days.

Below is a set of instructions for getting the Nice EPG running within MythTV. This just covers the analog stations that I am recording since I don’t have a satellite dish installed but should work for any set of stations that you are tuning.

  1. Login as the mythtv user.
  2. Open the /home/mythtv/.mythtv/ directory
  3. Create a new directory called epg in that directory. This new directory could be created anywhere within the mythtv users home directory. I just put it in the .mythtv directory so it’s out of the way and next to the other MythTV related configuration directories like channels, which contains my channel icons.
  4. Create a new shell script file called nice.net.nz.sh in the epg directory. This will be used to script the download of the Nice EPG and to then populate the MythTV program database. This script could be named anything you like.
  5. Populate the newly created shell script with the following:
    #!/bin/bash
    wget http://nice.net.nz/epg/listings.xml.gz
    gunzip -f listings.xml.gz
    mythfilldatabase --no-delete --file 1 -1 listings.xml --update
  6. Alter the XMLTV ID values within the MythTV configuration for the channels that you want to have updated by the Nice EPG. This can be done using mythtv-setup or by using mythfilldatabase passing the --manual flag rather than --update. The XMLTV ID values I am using based on the Nice EPG are below.
  7. Analog Channel ID mappings to Nice EPG XMLTV Channel ID
    Channel Analog Channel ID Nice EPG XMLTV ID
    TV ONE 2 1031.dvb.guide
    TV2 4 1032.dvb.guide
    TV3 7 1033.dvb.guide
    C4 9 1034.dvb.guide
    Juice TV 57 1007.dvb.guide
    Prime 59 1037.dvb.guide
  8. Open up KCron or any other Crontab editor of your choice.
  9. Schedule the newly created shell script nice.net.nz.sh to run daily at a suitable time as the mythtv user. Since it doesn’t do any web-site scraping it is much faster than xmlTVNZ so could be run at any time of the day without any problems. Based on the last time the listings.xml.gz file was updated on nice.net.nz (~5:30 AM) it would be good to schedule it sometime after 6 AM.

3 Responses to “Setting up an EPG for MythTV in New Zealand”

  1. hads says:

    The listings have moved from the nice domain, they are now available at epg.pvr.geek.nz

    Also, the listings-sky or listings-freeview or listings-all files have superseeded the old listings file, they use a new XMLTVID format that doesn’t rely on the DVB PIDS. This is needed for the new channels on both Sky and Freeview.

    You may also want to look into tv_grab_nz-py which as an XMLTV compliant grabber to use with mythfilldatabase.

    hads

  2. Thanks hads. Have updated to the new domain.

  3. Dave says:

    Hi There.
    I also had heaps of problems with xmltvnz so wrote my own. AND xmltvnz is no longer free. If you want an xml updater that is free and in my option better due to the fact that it is self updating and self checking. Things which xmltvnz does not do. Well did not do in the FREE version.

    Website: http://gbpvr.com/pmwiki/pmwiki.php/Utility/Djkxml

    It was written originally for use with GBPVR and has been modified to also work with SageTV but should pretty much work with any PVR that is able to read xml files for their source. The downside for mythTV users is that djkxml is written for windows so you’ll need to use a windows box to run it. Or maybe it’ll work under wine, haven’t tried it.

    Installation is easy and is also details on the above webpage.

    And it’s FREE FREE FREE.