[mythtv-users] Ruby script for grabbing UK channel logos from LyngSat

James Le Cuirot chewi at aura-online.co.uk
Sun Sep 30 20:42:34 UTC 2007

Hi there. I'm new to the list and I need to ask a few things but I
thought I'd start by contributing something first. (-:

The only script I've seen for grabbing logos for UK satellite users
works using fuzzy name matching. I felt that wasn't ideal and set about
writing a better one. Ruby is my weapon of choice. Sorry if you don't
have it installed. As well as Ruby itself, you will also need the
Hpricot parsing library and the mysql-ruby library.

Instead of matching by name, it matches by service ID, which is both
unique and reliable. It scrapes three LyngSat pages to get its
information. Why three? Well one of them did have both the SIDs and the
logo URLs together but some of the channels were missing. I have no
idea why. By combining the data from these three pages, far fewer get
left behind. I've found it to be extremely accurate, perhaps even
perfect! I'm quite sure that the only channels it didn't add logos for
don't have logos anyway.

I'm on Gentoo and I'm not familiar with MythTV setups on other distros
but it looks for mysql.txt in several different locations. One of them
should work for you. It creates a new directory called logos in the same
directory as mysql.txt and puts the images in there. Make sure you run
the script as a user that has sufficient write permissions, usually
either mythtv or root. I invoke it as the mythtv user by using sudo as

root at rhapsody # sudo -u mythtv ruby lyngsat-logo-uk.rb

To minimise the impact on LyngSat's servers, the script only downloads
new and updated logos on subsequent runs by using the If-Modified-Since

I hope some people find this useful. Devs, feel free to add this to the
scripts in contrib if you want. I'm not sure how often and how much
LyngSat change their pages since I'm new to all this but I wrote it to
be fairly resilient.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lyngsat-logo-uk.rb
Type: application/x-ruby
Size: 4147 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20070930/adf12a39/attachment.bin 

More information about the mythtv-users mailing list