XMLTV to XHTML+RDFa

The XMLTV format is designed for storing TV listings in XML. It was originally created by my co-aulmni Ed Avis at Imperial College.

This script converts an XMLTV file into a set of XHTML files displaying the TV listings sorted by time and date, by genre and by channel. Whatsmore, the XHTML is marked up using RDFa which allows the data to be parsed and handled by RDF tools.

You probably want to use this script as part of a tool chain including XMLTV grabbers and tv_grep. I use it as part of the following script, run automatically at 6 am every day:

#!/bin/sh

DIR=/home/tai/public_html/vhosts/goddamn.co.uk/tv

tv_grab_uk_rt --days 2 >$DIR/tv.xmltv
tv_grab_uk_bbcbackstage >$DIR/radio.xmltv
tv_cat $DIR/tv.xmltv $DIR/radio.xmltv >$DIR/all.xmltv
tv_grep \
        --on-after `date -Is -d "6am today"` \
        --on-before `date -Is -d "6am tomorrow"` \
        <$DIR/all.xmltv \
        >$DIR/today.xmltv
rm -f $DIR/*.html
/home/tai/bin/xmltv2xhtml.pl \
        --d_fmt='%A' \
        --target-directory=$DIR/ \
        $DIR/today.xmltv

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]example-tv/24-Mar-2009 11:24 - Example output (Not updated regularly!!)
[   ]COPYING24-Feb-2009 16:09 18KGNU General Public Licence
[TXT]xmltv2xhtml.pl.html24-Mar-2009 11:30 166KPerl script with syntax highlighting
[TXT]xmltv2xhtml.pl.txt24-Mar-2009 11:29 19KPerl script

Apache/2.2.14 (Ubuntu) Server at buzzword.org.uk Port 80