Apr 13 2013

How to get free TV schedule information for MythTV

It seems that if you live in the U.S.A., the MythTV people would really like to entice you to pay for a subscription-based TV listings service, but not everyone will do that. So, if you don’t want to pay, how do you populate your TV schedule grid with program information?

The easiest and most unquestionably legal way to do it is to simply grab the listing from the TV transmitters themselves. Almost all digital TV channels transmit schedule information, and to use it you simply need to make sure that on the MythTV backend, under Video Sources, the Listings grabber is set to Transmitted Guide Only (EIT).

The downside of this is that you will only get schedule information for a limited time, typically 1-3 days out from your current date. So, you won’t be able to schedule a program a week in advance. And another thing that might bother some users is that it will cause MythTV to operate your tuners continuously, because MythTV apparently constantly scans the channels for new EIT data (see this discussion in the HDHomeRun forum).

The other way is to use an external program such as zap2xml (Zap2it TV listings to XMLTV or XTVD .xml). In this case you set the MythTV backend Listings grabber setting to “No grabber” and use the zap2xml software to grab the listings and populate the database. The people who profit by selling the TV listings service don’t much like it if you do that, and therefore their proponents try to spread FUD (Fear-Uncertainty-Doubt) about the legality of doing this, but as a practical matter we highly doubt anyone will ever get in trouble for obtaining TV listings this way, and no one has up to this point, to the best of our knowledge. However, if you choose to use this method just be aware that there might be a cloud over the legality of doing so, at least if you believe the supporters of the commercial service. The larger concern is that someday this service will stop working, but that could happen with the pay service also.

Note that people who live outside the U.S.A. have no choice other than to use either the transmitted guide data or a free service, since the pay service only includes U.S. listings.

Generally it is a two step process:  You first run zap2xml to generate the required xmltv.xml file, then run mythfilldatabase (with appropriate options) to import the xmltv.xml file into the MythTV backend.

When you run mythfilldatabase, if you see error messages that include the phrase “Unknown xmltv channel identifier”, this means you need to open the xmltv.xml file in a text viewer or editor and find the channel id for each channel. Then go into the MythTV backend channel editor. For each channel there is an XMLTV ID field. You will need to place the correct channel id from the XML file (the entire string between the quotation marks) into the corresponding XML ID field, then select Next and (on the next screen) Finish, and you will need to do this for each channel. If you do this correctly, the “Unknown xmltv channel identifier” errors should disappear the next time your run mythfilldatabase.

EDIT: After this article was published, we discovered an additional similar program called WebGrab+Plus. It is described as follows: “WebGrab+Plus is a multi-site incremental xmltv epg grabber. It collects tv-program guide data from selected tvguide sites for your favourite channels.” There are some installation hints for WebGrab+Plus here. We have not attempted to install or use WebGrab+Plus, but just wanted to note that this possible alternative exists.

If you know of any other ways to get free TV schedule information for MythTV, please feel free to share in the comments. But if you simply want to debate the legality of the alternatives, please don’t bother – as the title of the blog implies, these are simply technical notes, and not a forum for endless debates over whether something should or should not be done, and we will probably just delete any comments that don’t add to the technical knowledge presented here.

Related Article:
Some hints for getting free-to-air satellite channels into the Electronic Program Guide in Kodi (or another frontend) (Free-To-Air America)


1 comment

  1. Darrin Auxier

    Great article, thanks a lot!

    I found that it was a little easier using Mysql Workbench to make the changes to the channel information than navigating the UI.
    — Disclaimer – updating tables directly via mysql is almost certainly not supported by MythTV, but this is a very simple change, and it worked for me.

    Once connected through MySql workbench, first run the following query and note the sourceid of the schedule info you are interested in :
    select * from videosource;
    (paste the query into MySQL Workbench click the 2nd “lightning bolt” icon to run only the query that your cursor is on)

    Next, you’ll query your channels for your sourceid and change the “xmltvid” value to the one that is in the zap2it xml file.
    ### In the following queries, the sourceid is 3 – change this to whatever you found your sourceid to be :

    If you prefer, you can make a backup of the table first :
    create table channel_bak as select chanid, channum, freqid, sourceid, callsign, name, xmltvid, atsc_major_chan, atsc_minor_chan from channel where sourceid = 3;
    (I’m saving enough information that I can clearly identify what the xmltvid used to be prior to my changes per station)

    ### Query the existing set of channels that you have not already migrated to zap2it
    select chanid, channum, freqid, sourceid, callsign, name, xmltvid, last_record from channel where xmltvid not like ‘%.labs.zap2it.com’ and sourceid=3 order by callsign, last_record desc, xmltvid;

    ## I found the last_record column useful – if you’ve never recorded a channel, there’s a good chance that it’s just clutter.
    ### Now just double-click the xmltvid column for each record to change it – cut-and-paste from the xml file
    ### Once you are done, click “Apply”
    ### It will show you all of the SQL for the changes, I prefer to save those SQL statements by copying them to a text file, but that’s just me.

    ### Show existing channels already converted to zap2it
    select chanid, channum, freqid, xmltvid from channel where xmltvid like ‘%.labs.zap2it.com’;

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

%d bloggers like this: