Freevo

- Index
- XMLTV

# XMLTV

Page Index:

1. Installation
   1. RPMS
   2. Debian Packages
2. Grabbing listings
   1. Belgian(Dutch) listings
   2. Dutch listings
   3. UK listings
   4. North American listings
   5. German listings
   6. Swedish listings
   7. New Zealand listings
   8. Australia
3. Use in Freevo
4. Channel Logos
5. Thanks

You can use scripts from the XMLTV project to pull XML files describing your local programming. Put them in /tmp/TV.xml so that freevo can find them. Run tv_grab_na (if you are in the US) with the --configure once to have it ask you for your location and figure out the channels you want. You now need to carefully read the instructions in the TV section of the freevo_config.py file to manually set up the channels for your system.

Also, if your listing provider supports it, you can use station cover logos into the freevo interface. To download and prepare the cover logos for usage in freevo, all you need to do is run freevo makelogos. Then the next time you go into the TV guide, you'll see all the stations logos.

## Installation

XMLTV: http://sourceforge.net/project/showfiles.php?group_id=39046

To install XMLTV, a number of modules are required, for convenience, here are some places to get the modules, "precompiled":

### RPMS

Manually download from http://atrpms.physik.fu-berlin.de/dist/fc1/xmltv/ or

Install apt-get as suggested on the site. There are a lot of different Perl dependencies which apt-get will take care of for you. As of writing (03/03/2004) you need to add

    rpm http://apt.physik.fu-berlin.de fedora/1/en/i386 at-bleeding

to your /etc/apt/sources.list

to get all of xmltv installed as it needs the "bleeding-edge" installation of pwlib to satisfy dependencies. Be sure to change it back to at-testing, at-good or at-stable as other bleeding edge packages may lead to a lot of instability.

If preferred a yum repository is also available -

    [atrpms testing]
    name=Red Hat Linux 9 ATrpms testing
    baseurl=http://apt.physik.fu-berlin.de/fedora/1/en/i386/at-bleeding

### Debian Packages

http://packages.qa.debian.org/x/xmltv.html

The XMLTV README has instructions for using the Perl CPAN method of downloading and installing missing modules.

Try using "force install <modulename>" if the regular install fails due to broken tests. The CPAN install process is quite noisy, make sure to read all output to find the real problem when a step fails.

## Grabbing listings

Configure xmltv via the xmltv documented installation instructions. Then run the xml tv guide grabber periodically to have it pull the XML files describing your television programming.

For automatic downloading, you can add a line like this to your crontab:

    0 3 * * * /usr/bin/tv_grab_na --days=2 > /tmp/TV.xml 2>/tmp/TV.xml.error &

The "2>/tmp/TV.xml.error" bit saves the grabber's stderr output to a file. The "&" backgrounds the grabbing process. Without the "&", XMLTV will run in the foreground and if the process takes more than a minute, cron will kill it, leaving you with a partial XML file that Freevo can't use.

The Freevo module "epg_xmltv.py" can be run standalone to generate a translated version of the TV guide that makes the first startup a lot quicker. NOTE Add better instructions

Here's another shell script that you can cron that may help you out.

    #!/bin/sh

    /usr/bin/tv_grab_na --listings "$HOME/freevo/xmltv/listings_%d%m%Y.xml" --days 1
    rm /tmp/TV.xml
    ln -s `date +'$HOME/freevo/xmltv/listings_%d%m%Y.xml'` /tmp/TV.xml

### Belgian(Dutch) listings

The old xml_tv_be.py script has been removed from the Freevo CVS repository. A new grabber was developped to replace it. The new tv grabber is part of the PyTVGrab package and can be found at the following adress : http://pytvgrab.sourceforge.net

Usage is the same as the Perl XMLTV scripts. More documentation can be found on the PyTVGrab Site

- download the guide for the next two days :

    # tv_grab_be_tvb -n2 -o /tmp/TV.xml

- download the guide for the next n days, example 7 days :

    # tv_grab_be_tvb -n7 -o /tmp/TV.xml

### Dutch listings

Use tv_grab_nl from the XMLTV package for NL listings or use PyTVGrab (See above)

As an alternative, you can use the script from http://www.addictivesoftware.net/index.php?option=content&task=view&id=3&Itemid=28. The maintainer of the script gives the following description of the script:

Because the standard tv_grab_nl script can be quite a strain on the www.tvgids.nl website and takes about an hour to get 1 day of detailed information. I wrote a script to get that info once a night, and make the resulting xml available. The tv_grab_nl_wolf script from XMLTV does a similar thing, but this script only parses the minimum information required, program name, channel and start/stop times, and I wanted the extended info.

As an added feature, the script contains image links for all the channel logo's.

### UK listings

The tv_grab_uk_rt script from the XMLTV package for UK listings is no longer working. I found the following from the mailing lists worked:

    #!/bin/bash
    # Get yesterday's, and the following weeks' listings in XMLTV format
    #
    BASE_URL='http://bleb.org/tv/data/listings'
    DAYS=-1,0,1,2,3,4,5,6
    FORMAT=XMLTV
    FILE=BZIP2
    TIME_OFFSET="+0060"
    CHANNELS=bbc1,bbc2,itv1,ch4,five,sky_one,uk_history,uk_horizons,e4,itv2,cartoon_network,uk_gold,bbc_radio4,bbc3,bbc4,bbc7
    wget -U 'Freevo Listing' -O '/tmp/listings.xml.bz2' "$BASE_URL?days=$DAYS&format=$FORMAT&file=$FILE&channels=$CHANNELS"
    rm -f /tmp/listings.xml
    bunzip2 /tmp/listings.xml.bz2
    cat /tmp/listings.xml | perl -pi -e 's/(\d{14,})/$1 ${TIME_OFFSET}/g' >/tmp/TV.xml
    cd /usr/lib/python2.3/site-packages/freevo/
    su -c "freevo execute tv/epg_xmltv.py" freevo

### North American listings

In order to use XMLTV for North America, you will need to create a Zap2It Data Direct).

Once you have your Data Direct account, you will need to create a "channel lineup" within it (via the Zap2It web interface). This lineup describes the channels which will be included in your XMLTV downloads. They are normally defined by specifying your zip/postal code and then choosing your service provider (e.g. a cable company).

Because the provider of North American listings has recently stopped providing stop time data, an extra step is required to guess the stop times if you are a user of the tv_grab_na tool. The simplest way to fix it is to re-process the guide with tv_sort, which will fix the broken listings. (tv_sort is included with xmltv, so you shouldn't need to install anything).

    #!/bin/sh

    todayis=`date +%Y%m%d`
    /usr/bin/tv_grab_na --days 1 | tv_sort > $HOME/freevo/xmltv/listings_$todayis.xml
    rm -f /tmp/TV.xml
    ln -s $HOME/freevo/xmltv/listings_$todayis.xml /tmp/TV.xml

(This recipe seems to be outdated now (or does Data Direct suffer the same problem)? It's cleaner than the generic download script at the top of the section, anyway, and runs once you add _dd to the command-name. Should also note that this script assumes (AFAICS) you will be running as the freevo user (or at least someone to whose $HOME directory every other user has access)).

Upgrading Notes:

- XMLTV 0.5.32 is out tv_grab_na_dd from version 0.5.31 was a preview release 0.5.32 has different arguments. zap2it has notified XMLTV developers that changes to their site in mid may 2004 will break tv_grab_na.

  XMLTV will discontinue tv_grab_na in further releases in favor of tv_grab_na_dd.

  UPDATE Apr 2/04 from XMLTV website: The latest version is 0.5.31. This fixes some grabber problems with the changeover from winter to summer time in many countries, and adds a new grabber tv_grab_na_dd for US and Canadian listings using the Zap2it Data Direct service. (Sign up using certificate code TGYM-ZKOC-BUTV). It also has some other fixes in various grabbers and tv_check

  TIP: Upgrade to XMLTV 5.23 or higher as earlier versions will now give you an error similar to "check your postal code/zip code"

### German listings

It seems that tv_grab_de doesn't work anymore, use tv_grab_de_tvtoday instead, coming with official XMLTV package since Version 0.5.30. ( http://sourceforge.net/project/showfiles.php?group_id=39046)

### Swedish listings

The swedish listings grabber is now called tv_grab_se since tv_grab_sn broke.

Seems like freevo 1.3.4 dosent handle the channelnames correctly, they will be named to something like 14.dagenstv.com in xmltv. But when you try to schedule it with freevo it get's renamed to 14.dagenscom. You have to change a line in the tv_grab_sn in order to get it to work (might be changed in freevo cvs to handle the original names thow..). Jump to the line 268 and change

- my $ch_xid = "$ch_did.dagenstv.com";

to

- my $ch_xid = "$ch_did";

then edit your xmltv names in local_config.py to point to 14 instead of 14.dagenstv.com. Dont really know if anyone else were experiencing any problems on this matter, but anyway, if you are > here's the solution

### New Zealand listings

tv_grab_nz appears to have some problems in the version tested as of xmltv-0.5.31. Things appear to work ok, but TVTime doesn't interpret the lack of +1200 in the start and stop of channels so you end up with out of synch time.

### Australia

search Google for "tv_grab_au". Its not part of the xmltv package yet, but its usable and its out there.

There is an error in the listings source for Australia where xml special characters are escaped twice, so you get &amp;amp rather than &amp; . Here's a small script that grabs the listings and fixes this error.

    #!/bin/bash -x

    XMLTV_FILE="/tmp/TV.xml"
    LISTINGS_FILE=`date +"$HOME/xmltv/listings_%Y%m%d.xml"`

    tv_grab_au --output "${LISTINGS_FILE}" --days 7

    # make sure the file is larger than 4k - otherwise there was an error in the data
    if [ `ls -sk "${LISTINGS_FILE}" | awk '{print $1;}'` -gt 4 ] ; then
            # fix the double escapes
            sed -i 's/\&amp;amp;/\&amp;/g' "${LISTINGS_FILE}"
            echo Listing is good
            rm "${XMLTV_FILE}"
            ln -s "${LISTINGS_FILE}" "${XMLTV_FILE}"
    else
            echo Listing is bad
    fi

    freevo schedulefavorites

## Use in Freevo

For some regions like North America everything is working out of the box. Other grabbers don't include station ids to the file so you need to update the TV_CHANNELS variable in local_conf.py. Please see that file for more detailed instructions!

## Channel Logos

Run `freevo makelogos`

It uses the information in the '/tmp/TV.xml' file, which has url's for the logos, to locate and grab the images. The logos are stored and will be displayed in the channel list. It's a know bug that the images are scaled in the tv guide to fit the given rectangle.

## Thanks

Much thanks to James Oakley of the openpvr project, who wrote the Python XMLTV parsing module which is used extensively for XMLTV support in Freevo.

last edited 2005-01-05 11:17:45 by JohnMolohan
current version: http://freevo.sourceforge.net/cgi-bin/doc/XMLTV