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

[PARENTDIR]Parent Directory  -  
[DIR]example-tv/2009-03-24 11:24 - Example output (Not updated regularly!!)
[TXT]xmltv2xhtml.pl.html2009-03-24 11:30 166KPerl script with syntax highlighting
[TXT]xmltv2xhtml.pl.txt2009-03-24 11:29 19KPerl script
[   ]COPYING2009-02-24 16:09 18KGNU General Public Licence

Apache/2.4.52 (Ubuntu) Server at buzzword.org.uk Port 443