Import XMLTV to EyeTV

From Exterior Memory
Jump to: navigation, search

Background: Bye bye Tvtv, hello XMLTV

EyeTV supports, which I have used to fetch program information since late 2004. I have been very happy with tvtv and Elgato's support in 2005, with good technical support and bug fixes in reasonable time. In 2009 and 2011 I had a few problems with channels that were not available. In 2009 I got a reply that this was caused by their upstream data provider. In 2011, the EPG data was available on their website, but not in EyeTV. Despite two mails, I never got a reply.

Because I refuse to pay for a mediocre service, I decided to find another source of EPG data. Thankfully EyeTV supports the XMLTV data format. Since I was cautious about (I wonder if it is the same data source as tvtv), and tvgidsnl does not supply XMLTV data (I would be happy to pay for that service, but my mail with that suggestion got no reply so far). In the end I end up using a "grabber" that retrieved EPG data from public webpages and converts that to XMLTV.

Finding a Grabber

The only commercial service that offers native EPG data is

MythTV Netherlands has a list of grabbers that download EPG data from public websites such as and

The XMLTV Project lists grabbers for other countries.

I first tried tv_grab_upc, but in the end choose tv_grab_nl_py, for which I wrote a few patches and suddenly became "maintainer".

In my experience the EPG data of grabbers like tv_grab_nl_py is decent, although commercial EPG services are still better. The difference is that tvtv has specific content for each episode of a series or a show, while grabbers sometimes only list generic information about the series or show. Also, the tight integration between EyeTV and tvtv means series are better categorized.

Installing tvgrabnlpy

Installing the grabber script is easy if you are familiar with the Unix terminal. For tvgrabnlpy it was even easier than their overly complicated installation instruction:


(This not only downloads the script, but some other crud as well.)

You need to decide where to store the configuration, cache and output file. I put everything in the same folder (the default is to use ~/.xmltv/).

To configure the channels, first create a configuration file:

./ --config-file tvgrab.conf --configure

Now edit tvgrab.conf.

Run tvgrabnlpy for the first time:

mkdir data
./ --config-file tvgrab.conf --days 2 --slowdays 1 --output data/epgdata.xml

If this run successfully, drag the resulting epgdata.xml to the EyeTV icon in the Dock. EyeTV does not give feedback, but should have stored the data.

Open the "Channels" tab in the EyeTV Programs window. For each channel, select "xmltv" from the EPG column. This should open a pop up where you can choose the associated channel. Choose the appropriate channel, and EyeTV will from now on use the XMLTV data that you fetch it.

If the only listed channel is "None", EyeTV has not properly received the data yet. Make sure that the XML file you dropped on the EyeTV icon is valid. Open it and examine yourself, or feed it to xmllint to validate the contents.

If you see multiple listings for each channel in the selection window, you have fed EyeTV with multiple XMLTV data sources. First clear the EPG database (Go to the Program Guide tab, and select "Clear EPG Database" from the small pop-up menu in the toolbar) and re-import the XMLTV data again.

Running tvgrabnlpy

You need to periodically fetch new program data to EyeTV.

The following shell script, called runs tvgrabnlpy, and feeds the result to EyeTV:

cd /Users/freek/Repository/tvgrabnlpy
basename=`date '+%A%Hh'`

# Fetch TV guide from
./tv_grab_nl_py --config-file tvgrab.conf --days 6 --slowdays 2 --output $xmlfile --cache tvgrab.cache 2> $logfile

# open EyeTV with file
open -a EyeTV $xmlfile

This stores the EPG data in files named after days of the week, and stored in the data directory. This allows me to verify that the fetching is successful.

Create a cron job

Mac OS X uses launchd to start processes, including scripts that are run periodically. The following launchd file specifies to run the above script twice a day. You need to modify the username, path to and the minutes. (It is recommended not to run the script between 0:00 and 4:00 because shows the previous day's schedule.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Copy the above file to ~/Library/LaunchAgents/ The Launch Agent, as it is called, should now automatically load after a reboot.

To manually load it, run:

launchctl load ~/Library/LaunchAgents/

Since it is a Launch Agent, it is only started if the user is logged in. This is intended since EyeTV must run for proper use.

You can test if everything runs smoothly by letting launchctl start it immediately (overriding the scheduled time for a moment):

launchctl start