This is a Perl script that converts a sorted XML file made by XMLTV into a nicely formatted HTML TV guide. This is licensed under the GNU GPL.

News: Ed Avis is working on a new XML-based format for XMLTV 0.6. I am waiting for this format to be finalised before further progress with tv2html.

See also PZSchedule, a Windows application that creates an HTML TV guide which allows users to click on the programs to record them. PZSchedules' HTML stuff is derived from tv2html.

Download

Using tv2html.pl - An Example

tv_grab_uk --days 2 > tv-listings.xml
tv_sort tv-listings-sorted.xml
tv2html.pl tv-listings.html

Option Files

As of version 0.1.0, tv2html.pl now supports option files. It will read options from these files if they exist:

  1. /etc/tv2html.conf
  2. ~/.tv2html.conf
  3. ~/etc/tv2html.conf
  4. /etc/tv2html.important.conf

If a file doesn't exist, it will be ignored. If an option is set more than once, the last value applies. (The files are read in the order above, so the system administrator can over-ride any settings in /etc/tv2html.important.conf if he wants.

Here is an example /etc/tv2html.conf:

ChannelOrder london.bbc1.bbc.co.uk london.bbc2.bbc.co.uk carlton.com channel4.com channel5.co.uk
ChannelHideUnordered 1
DisplayChannels Name
DisplayChannels2 Name
StyleByHTML 1
StyleByCSS 1
DisplayDescriptions 0

ChannelOrder specifies which order the columns should be in. It should use the channel IDs, which look like domain names. If you don't know what the channel IDs are, you should be able to find them by reading the XML file.

If you set ChannelHideUnordered to 1, it will leave any channels not explicitly specified in the ChannelOrder setting out of the end HTML file completely. If you set it to 0, they are put in the right-hand columns.

DisplayChannels controls how the headings for the channels are displayed at the top of the columns. You can set it to "Name", for example "BBC 1"; or to "Caption" in which case it displays the channel's logo plus the name as a caption; or to "Icon" in which case it just displays the logo; or to "ID" which is the old behaviour of just displaying the channel ID like "london.bbc1.bbc.co.uk"

DisplayChannels2 does the same, but effects the channels as they are displayed at the top of subsequent days (not the first day).

StyleByCSS can be set to 1 or 0. If set to 1, the HTML file will use CSS to set fonts, colours, etc.

StyleByHTML can be set to 1 or 0. If set to 1, the HTML file will use tags, etc to style the page. Note, that StyleByCSS and StyleByHTML can both be 1, or both be 0 if desired.

DisplayDescriptions can be 1 or 0. If set to 1, there will be plot summaries for TV shows.