tvtime

Configuring tvtime for displaying XMLTV listings

Billy Biggs and Jeffrey Forman, 21 Sep 2003

XMLTV is an excellent application for downloading episode guide information and storing it in a standardized file format. As of tvtime version 0.9.10, we support display of show title, sub-title, times and description on the OSD. This document describes how to configure and run XMLTV for use with tvtime.

XMLTV listings screenshot

1. Run XMLTV

XMLTV is a collection of scripts which download TV listings to a local XML file. The scripts are named by location, for example, tv_grab_na for North America, or tv_grab_de for Germany. With the North American script, you first configure it for your provider by running:

    tv_grab_na  --configure

This runs an interactive setup to determine your cable provider. Listings are then downloaded by running:

    tv_grab_na | tv_sort > ~/listings.xml

This will grab the listings for the next week and store it in the file listings.xml in your home directory. The tv_grab_na command has many options to control its behavior. tv_sort is a utility shipped with xmltv that will perform sanity checks on the data, and add end times for many programs. It will take some time to grab the listings, on Jeffrey's system, a week of shows was over 4MB.

2. Tell tvtime where the listings are

Telling tvtime where to find the XMLTV listings is easy. Simply run:

    tvtime-configure --xmltv=~/listings.xml

This will write to the tvtime config file the location of your downloaded listings file.

3. Manually configure channels

Each channel in an XMLTV file is given a unique identifier and a list of names for that channel. tvtime maps XMLTV channels to tvtime channels as follows:

  1. If the station entry in the stationlist.xml file contains an xmltvid parameter, use that.
  2. Otherwise, search the channel list in the xmltv file for a channel entry that matches the name of the current channel.

For example, the following is the entry for CNN in Billy's XMLTV listings file:

    <channel id="C18cnn.zap2it.com">
      <display-name>18 CNN</display-name>
      <display-name>18</display-name>
    </channel>

And here is the default stationlist entry in tvtime:

    <station name="18" active="1" position="18" band="US Cable"
     channel="18" finetune="0" norm="NTSC"/>

In this stationlist entry, the name "18" matches the second display name of in the XMLTV entry.

Unfortunately, many XMLTV sources do not contain enough information to automatically perform this mapping. Here is the output on Jeffrey's provider:

    <channel id="4 KXAN">
      <display-name>Channel 4 KXAN</display-name>
    </channel>

The display name "Channel 4 KXAN" does not match the default name in tvtime, nor could it. To get around this, you can manually specify an xmltvid parameter in the stationlist entry, as follows:

    <station name="4" active="1" position="4" band="US Cable"
        channel="4" finetune="0" norm="NTSC" xmltvid="4 KXAN"/>

The xmltvid="4 KXAN" matches the id="4 KXAN" in the XMLTV <channel> tag, and this lets tvtime know which channel information to use.

4. Configure xmltv to run weekly

It's easy to use cron to have your XMLTV listings downloaded weekly. Since everyone forgets the syntax, here is an example of a crontab entry:

    0 2 * * 0 /usr/bin/tv_grab_na | /usr/bin/tv_sort > ~/listings.xml

This will download the listings every Sunday at 2am.

5. Bugs and suggestions

If you have any suggestions on how we can simplify or better automate the setup process of using tvtime and XMLTV, please send an email to vektor@dumbterm.net.

6. Changelog

  • Oct 13, 2003: Update example to use tv_sort.