TL;DR
You can now find my EPG json grabber client for Schedules Direct on Github.
The utilities download and cache the EPG data in a sqlite database. They can produce an output in xmltv format for systems like EyeTV, MythTV etc.. They can also create short overviews (e.g. by genre) if you want to check what sci-fi episodes are coming up.
The utilities are written in Python3 and should run on any python3 base installation.
The story
A few weeks ago the EPG function in EyeTV on my old Mac Mini stopped working.
Until then I used the Gracenote service integrated in EyeTV to download EPGs. As far as I can tell the Gracenote downloader tries to contact its server but fails. System logs indicate that the OS rejects the connection due to some SSL handshake error. The machine is to old for the installed Mac OS to be updated … so, no hope to get the SSL issue fixed.
This happened – of course – just weeks after I renewed the Gracenote subscription, and unsurprisingly Geniatech – the seller of the subscription – didn’t react on my bug report or plea for help.
What to do?
EyeTV offers two other sources for EPGs: DVB and xmltv
DVB gets the EPG information from the TV signal itself. The problem: In order to receive the signal you must switch to that channel for a few minutes. With over 40 channels this becomes infeasible. And even then you only get 3 days worth of EPG (compared to 14 days with Gracenote).
The xmltv option takes the information from a text file in xmltv format. The format is well documented and EyeTV can read an xmltv file using a special command. But where to get the information from?
Schedules Direct is a provider of EPG information and also offers – unlike many other providers – listings for stations in Europe. However rather than providing the information in xmltv format you have to query their API and get chunks of information back in JSON format.
The utilities
And that’s where the utilities come in.
- sdjsongrab.py is the part that talks to the API and caches the information in a sqlite database.
- You have to run sdconf.py first to configure your name and password and select the lineups (sets of stations) whose schedule you want to download.
- genepg.py will create the xmltv file from the information stored in the database.
- maintenance.py will perform some database related operations.
The most difficult part is to select which lineups to use. A lineup determines the stations whose EPG you can access. There are hundreds of lineups available from which you can choose up to four. They mostly contain stations grouped by geographic location, cable provider, etc. sdconf.py exposes the part of the SD API that helps you select suitable ones.
With the help of filter definition files geneps.py can generate quick overviews of all programs with a given genre and/or name. This can be used for example to get a quick overview of all sci-fi programs or all programs containing “Star Trek” in their title.
maintenance.py can be used to display various information from the database itself. Most notably a list of genres that can be used in the filter definition files.
You can find more information in the README and doc files of this project.
Comimg up...
The software is still in development. Currently I’m observing how the size of the database grows and if and when a pruning is needed. At the moment it's to early to tell.
I only use the generated xmltv file with EyeTV and can’t check it with other software. If you have any suggestions let me know.