Another day, another MythTV experience.
I spent most of yesterday afternoon and evening coding my new TV programme data grabber. This one grabs programme timetable information from Chello, which is the name of UPC‘s cable TV (and cable Internet) offering.
The standard XMLTV grabber for The Netherlands isn’t very good, so I quickly replaced it with a different one, written in Python. This one is much better and is kept nicely up to date by its author.
Anyway, even that one has a major shortcoming, namely that it doesn’t know anything about many of the channels in UPC’s digital cable package. There are many cable companies operating all over the country and each one offers a different selection of channels, so finding a good data source for all of them is difficult.
So, after several hours of Ruby coding, utilising the excellent REXML library to produce XMLTV format data, I had a tool I could use to populate my MythTV database with programme information for the missing channels. As a bonus, it even grabs channel icons for use in the on-screen display and programme guide.
I started by adding data for just BBC 3, BBC4, The Travel Channel and a few others. Then, I checked MythWeb in my browser and, sure enough, The Travel Channel was now displaying a lot of Globe Trekker episodes. I quickly created a rule to record all showings of this, one of our favourite programmes, on any channel that happens to be broadcasting it.
Later in the evening, I added data for a few more channels, such as Discovery Travel & Living. The MythTV system immediately applied the Globe Trekker rule I created earlier in the evening to ensure that the new episodes on this channel will also be recorded.
Confident that the new grabber is working properly, I have now added its invocation to cron and look forward to using it to exploit the full power of our shiny new PVR system.
When I’ve tidied up the code a little, I’ll make this script available for anyone who cares to use it.
mythfilldatabase is the program that actually takes all of the XMLTV data and pumps it into the MythTV database. The grabbers that this program will accept data from are hardcoded into the binary. Since I didn’t want to patch the source and recompile, I decided to add the programme data using a temporary file. A wrapper script takes care of the whole process:
xml_file=$( mktemp -p ~/.xmltv upc.XXXXXXXXXX )
video_source=2
tv_grab_nl_upc > $xml_file
mythfilldatabase –file $video_source -1 $xml_file
rm $xml_file
And Bob’s your father’s brother!
If anyone needs tv_grab_nl_upc and can’t wait for it, drop me a line and I’ll send it to you.