TV guide tool
history
In the Netherlands a number of websites are available containing the Dutch TV guide. Most of these web sites offer the TV guide in a format that I don’t like. That is why I wrote a small script in Python and bash to grab the TV guide from such a site and create my own formatted TV guide.
In January 2004 I converted these scripts into a Java application for Java 2 Standard Edition (J2SE) version 1.4. As of version 3.0 Java 5 is required.
My format for the TV guide is a single list containing all programs sorted on starting time. My favourite programs are highlighted.
download
If anyone wants to use this tool for his/her own benefits, please feel free to download the tool. Click here to download version 3.2 of the tool.
The zip file contains the Java source files including a build.xml file to build the project using Apache Ant. It also contains a pre-built version, in case you do not wish to build the tool yourself.
The zip file contains these files:
- configuration.txt
- This file contains the configuration for the tool. Here the start and end time of the TV guide can be specified, together with the time zone used to parse and format dates and times. Also the names of the TV channels and genres that have to be added to the TV guide are specified in this file. Finally, the names of your favourite TV programs can be specified in this file.
- tvguide.css
- This is the style sheet used by the generated HTML file. Move this file to the directory where the HTML file is generated.
- build.xml
- The build file to build the application using Apache Ant.
- src/tvguide/Configuration.java
- This class represents the configuration of the tool. The constructor parses the configuration file.
- src/tvguide/WwwProgramSource.java
- This class is reponsible for downloading the programs from a web site. In this class you can specify for which channels the list of programs must be obtained.
- src/tvguide/TVProgram.java
- This class represents a TV program.
- src/tvguide/Main.java
- This class contains the main method that is called when the tool is started. It uses the other classes to generate the TV guide.
- src/tvguide/StartTimeComparator.java
- This class implements a Comparator that is used to sort the TVPrograms on their start times.
- src/tvguide/HtmlGenerator.java
- This class generates the contents of the HTML file.
- src/tvguide/TimeConverter.java
- This class converts times in the format hh:mm to java.util.Date instances.
If you decide not to build the tool yourself, you can remove the src directory and all its contents.
requirements
To run the tool a Java 5 (or higher) Run-Time is required. Java Run-Times can be downloaded from Sun’s website.
To build the tool yourself, Apache Ant version 1.6 (or higher) is required. Apache Ant can be downloaded from the website of Apache Software Foundation.
build instructions
To build the tool using Ant, type the following command on your command prompt:
ant
To generate the Jar file, type the command:
ant dist
In case you don’t want to build the tool yourself, you can use the Jar file that is stored in the zip file.
running the tool
To run the tool, type the following command on your command prompt:
java -jar tvguide.jar configuration.txt tvguide.html
If you run the tool with the wrong number of arguments, the tool will print a short usage instruction.
For people living outside of the Netherlands, it might be handy to specify the time zone. The times in the guide will be translated for your time zone. For example, for the UK, add the argument -timezone Europe/London or change the time zone in the configuration file.
It is also possible to specify a start and end time of the TV guide. For example, to get all the programs starting from 6:00 PM, add the argument -start 18:00 or change the start time in the configuration file.
Note: the times 0:00 up to 5:59 are considered as times in the night from today to tomorrow! The times from 6:00 up to 23:59 are considered times of today.
sample output
Click here to see an example of the TV guide generated by the tool.
releases
| release | date | notes |
|---|---|---|
| 3.2 | August 21, 2010 | Changed URL for fetching channels. The old URL contains an advertisement. |
| 3.1 | August 15, 2010 | When downloading main page of tvgids.nl the application identifies itself as the Chrome web browser. This is necessary, because otherwise a web page in an unknown format would be returned. |
| 3.0 | January 3, 2008 | Upgraded to Java 5. Fixed regular expression for new layout of tvgids.nl and nu.nl. Also support for proxies is supported now. |
| 2.6 | August 28, 2005 | Fixed a NullPointerException caused by a missing start or end time of a program. |
| 2.5 | August 18, 2005 | Highlights specified in the configuration file are applied to both title and the genres of a program. This allows for example to highlight all movies and comedies. |
| 2.4 | August 14, 2005 | Configuration is now specified in separate file. |
| 2.3 | August 13, 2005 | Added genres to the TV guide. |
| 2.2 | August 11, 2005 | Added start time, end time and time zone as optional arguments. |
| 2.1 | August 3, 2005 | Fixed problem that for each channel the first program of the day had “null” as channel name. |
| 2.0 | August 3, 2005 | Highlights file must now be specified as argument of the tool. |
finally
I created this tool in a few evenings, so don’t expect too much from it. However, I used it more than three years now. It proofs its usefulness to me every day!
If you have questions about this tool, don’t hesitate to contact me.
