Import XMLTV to EyeTV
Background: Bye bye Tvtv, hello XMLTV
EyeTV supports tvtv.nl, 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 epgdata.com (I wonder if it is the same data source as tvtv), and tvgidsnl does not supply XMLTV data (I would be happy to pay tvgids.nl 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 epgdata.com.
The XMLTV Project lists grabbers for other countries.
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.
svn checkout http://tvgrabnlpy.googlecode.com/svn/ tvgrabnlpy
(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
To configure the channels, first create a configuration file:
./tv_grab_nl_py --config-file tvgrab.conf --configure
Run tvgrabnlpy for the first time:
mkdir data ./tv_grab_nl_py --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.
You need to periodically fetch new program data to EyeTV.
The following shell script, called
tvgrabnlpy, and feeds the result to EyeTV:
#!/bin/sh cd /Users/freek/Repository/tvgrabnlpy basename=`date '+%A%Hh'` xmlfile="data/$basename.xml" logfile="data/$basename.log" # Fetch TV guide from www.tvgids.nl ./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
update_eyetv_guide.sh script twice a day. You need to modify the username, path to update_eyetv_guide.sh and the minutes. (It is recommended not to run the script between 0:00 and 4:00 because tvgids.nl shows the previous day's schedule.)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.google.code.tvgrabnlpy.update_eyetv_guide</string> <key>UserName</key> <string>MY_USER_NAME</string> <key>Program</key> <string>/PATH/TO/update_eyetv_guide.sh</string> <key>StartCalendarInterval</key> <array> <dict> <key>Hour</key> <integer>4</integer> <key>Minute</key> <integer>RANDOM_NUMBER_BETWEEN_00_AND_59</integer> </dict> <dict> <key>Hour</key> <integer>16</integer> <key>Minute</key> <integer>RANDOM_NUMBER_BETWEEN_00_AND_59</integer> </dict> </array> </dict> </plist>
Copy the above file to ~/Library/LaunchAgents/com.google.code.tvgrabnlpy.update_eyetv_guide.plist The Launch Agent, as it is called, should now automatically load after a reboot.
To manually load it, run:
launchctl load ~/Library/LaunchAgents/com.google.code.tvgrabnlpy.update_eyetv_guide.plist
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 com.google.code.tvgrabnlpy.update_eyetv_guide