Mythtv using Schedules Direct in the UK

Schedules Direct

Now that Radio times listings are now longer updated I needed to move to using Schedules Direct in the UK. This is mostly a direct lift from the post https://www.mythtv.org/wiki/Migrating_to_Schedules_Direct_in_the_UK Go there and follow it. This post is for me in case it disappears.

You will need an account at schedules direct. They offer a 7 day trial, use that while you are getting it going. the get the one year membership. Remember the user name and password you need it below and next year when you want to renew. There is nothing elsxe you need here. The conversion is all done by the grabber script.

TV grabber JSON

To install tv_grab_sd_json with Ubuntu you need so software before it will work.

sudo apt-get install XMLTV
sudo apt-get install libdatetime-format-dateparse-perl
 
cpan
> install XML::TreePP
> install Lingua::EN::Numbers::Ordinate
> exit

Now download fir software from http://snapshot.xmltv.org/ gives you a zip file. Unzip it somewhere handy so you can see the contents. The README file is pretty good read it.

In short you need to run the following. I entered the schedules direct grabber, tv_grab_zz_sdjson, at the first prompt.

perl ./Makefile.PL
make
make test
make install

This will create a new file grab/sd_json/tv_grab_zz_sdjson copy that to /use/bin and allow it to be run by anyone (world). Your file may be different if you used a different code at the beginning.

sudo cp grab/zz_sdjson/tv_grab_zz_sdjson /usr/bin
sudo chmod 775 /usr/bin/tv_grab_zz_sdjson

Configure the feeds

We need to configure the feed so it pulls the data through for our region and gives the channels we want.

tv_grab_zz_sdjson --configure

When this runs you will be asked a few questions.

  • Cache File: Just accept the defaults, unless you want extra work.
  • Channel ID format: Select 2. MythTV Internal DD Grabber Format (eg: 12345)
  • Select previously shown format: 0: Date Only
  • Username: Your Schedules Direct user name.
  • Password: Your Schedules Direct password.

Some files get downloaded at this point. They should all be “200 OK”.

  • Current lineups enabled for your Schedules Direct account: GBR-1000083-DEFAULT For Guildford from Transmitter codes
  • Select mode: Lineups

Some more files get downloaded and again they should be “200 OK”.

This gave me a file like this:

cat ~/.xmltv/tv_grab_zz_sdjson.conf
cache=/home/LINUXNAME/.xmltv/tv_grab_zz_sdjson.cache
channel-id-format=mythtv
previously-shown-format=date
username=USERNAME
password=PASSWORD
mode=lineup
lineup=GBR-1000083-DEFAULT

Your values for LINUXNAME, USERNAME and PASSWORD will need to be adjusted to suit.

Test this new config file

tv_grab_sd_json --config-file ~/.xmltv/tv_grab_zz_sdjson.conf --output /tmp/xmltv_grab.xml

The output should be similar to the following:

Initializing...
** POST https://json.schedulesdirect.org/20141201/token ==> 200 OK
** GET https://json.schedulesdirect.org/20141201/status ==> 200 OK (1s)
Updating lineups...
Indexing channels...
Updating schedules...
** POST https://json.schedulesdirect.org/20141201/schedules/md5 ==> 200 OK (2s)
Updating programs...
Removing old cache entries...
Writing output...
Done

The resulting txt file that was output should look like this:


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">

<tv source-info-url="http://www.schedulesdirect.org" source-info-name="Schedules Direct" generator-info-name="tv_grab_zz_sdjson 1.1 2017/01/24 00:41:08">
<channel id="101972">
<display-name>BLAZE
<display-name>BLAZUK
<display-name>063
<icon src="https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s101972_h3_aa.png" width="360" height="270" />
</channel>
<channel id="102340">
<display-name>Sewing Quarter
<display-name>SEWQUA
<display-name>078
<icon height="270" width="360" src="https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s102340_h3_aa.png" />
</channel>

Remember to delete /tmp/xmltv_grab.xml when you have looked at it. we do not need it any more.

Backup Mythconverg database

The simplest way is to use the mysqldump, or you can use the built in scripts for Mythtv.

Set xmltv config

We can either copy the new tv_grab_zz_sdjson.conf config file or create a sym link either works.

cp ~/.xmltv/tv_grab_zz_sdjson.conf ~/.mythtv/SOURCENAME.xmltv

I call my ~/.mythtv/SOURCENAME.xmltv Freesat.xml as that is the name of the source in Mythtv.

Now you can run mythfilldatabase to update the channel listings.

NOTE: The original post talked about removing old program IDs, I found this made no difference either way. After running mythfilldatabase check your up coming recordings in Mythtv there will be some that have previously been recorded.

There was also mention of updating the new file ~/.mythtv/SOURCENAME.xmltv with channels you want to download and those you want to exclude. This also made no difference when I tried.

Leave a Reply

Your email address will not be published. Required fields are marked *