Fetching the Australian Programming Guide

In Australia getting a programming guide is almost a crime. There is a company called IceTV that offers a commercial programming guide, but it only includes Free To Air (FTA) channels.

One of the few alternatives to FTA channels is Foxtel (the Australian version of Sky in the UK) if you want to have about 100 channels.  There are other smaller providers like SELECTV but their market share is really small.

ozTiVo is the only alternative left if you want to grab Foxtel's or SelecTV's programming guide in a xmtv format. I was able to download a script written in Perl to grab the data in insert it into MythTV (can't find the link at the ozTivo website anymore).

I downloaded it and tried to use it but there was a problem with the Time Zone. As I'm not a Perl guru, but know PHP very well, I converted the script tp PHP and fixed the Time Zone problem.

Click here to download the script.

You can run the script as a cron process, but you can also run it when your computer starts.

Some people never switch their MythTV boxes off, sometimes I do.  The only problem with that is that it might miss downloading the programming guide. That's why I also put this script in the starting scripts. However, I did a change in the script: it writes a file with the date when it ran, and if the script have already run on a certain day, and you call it again (from cron or when the computer starts), it won't run. It will the next day though.

To make it work for your time zone, you have to edit it and find a line that says:


And change it to your zone. The Australian time zones are:

Australia/Lord_Howe - Lord Howe Island
Australia/Hobart - Tasmania - most locations
Australia/Currie - Tasmania - King Island
Australia/Melbourne - Victoria
Australia/Sydney - New South Wales - most locations
Australia/Broken_Hill - New South Wales - Yancowinna
Australia/Brisbane - Queensland - most locations
Australia/Lindeman - Queensland - Holiday Islands
Australia/Adelaide - South Australia
Australia/Darwin - Northern Territory
Australia/Perth - Western Australia

You might also like to change the MySQL user name and password (which are mythtv and mythtv respectively), or the database (I'm using the default mythconverg). Just edit the following two lines of the script:

$link = mysql_connect ("localhost", "mythtv", "mythtv") or die ("Could not connect to the database\n");

Running The Programming Guide Script

To run the programming guide script you have to call it with the video source you want to download. Optionally you can select a single channel from that video source by indicating its xmltvid.

./fetch_oztivo_php.ph videosource xmltvid

For example to download all the channels of the FreeToAir-Brisbane video source, call the script like this:

./fetch_oztivo_php.ph FreeToAir-Brisbane

If you want to download only the ABC (the xmltvid is ABC-Qld) channel from the FreeToAir-Brisbane video source, do the following:

./fetch_oztivo_php.ph FreeToAir-Brisbane ABC-Qld

Setting The Programming Guide Script as a Cron Process

Initially I set the programming guide to run every day of the week at a certain time. But if you have hundreds of boxes doing that, then you might kill the server that hosts the programming guide. To solve this problem I added a random number of seconds before the script starts:

00 3 * * * mythtv perl -le 'sleep rand 9000' && /path/fetch_oztivo_php.ph FreeToAir-Brisbane > /dev/null 2>/dev/null

The script is set to run every day at 3:00am, but it will run after a number of random seconds between 0 and 9000 (2:30 hours).

Continue Shoppping View Cart
Continue Shoppping View Wishlist