Linux HOWTOs

About | Home | Search


HOWTO: xmltv
Description: TV listings grabber
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# xmltv 0.5.44
# ============
# Prerequisites:
# perl


# Perl modules used by xmltv.
# If you want a bare-minimum installation, see the README.  Quite a few of
# these can be left out.

# Install them as root
su

# Start up the CPAN shell, update it if a newer version is available
perl -MCPAN -e shell
o conf make_install_arg UNINST=1
o conf prerequisites_policy follow
install Bundle::CPAN

# If you want to use tv_check (which is optional), you need Tk (perl-tk) and
# Tk::TableMatrix.  To install Tk, you need to be running X because 'make
# test' will try to open and close test windows.  I never had troube with
# Tk, but was only able to successfully build Tk::TableMatrix as of version
# 1.2

install Tk
install Tk::TableMatrix

# The rest:
install XML::Parser
install XML::Twig
install XML::Writer
install Date::Manip
install LWP
install Memoize
install Storable
install HTML::Parser
install HTML::TreeBuilder
install SOAP::Lite
install CGI
install Term::ProgressBar
install PerlIO::gzip
install Compress::Zlib
install Lingua::Preferred
install Unicode::String
install Lingua::EN::Numbers::Ordinate
install Log::TraceMessages
install WWW::Mechanize
install HTML::TableExtract

# If you're in the UK:
install Archive::Zip
install IO::Scalar

# If you're in Japan:
install Text::Kakasi

# If you're in Sweden:
install XML::LibXML
install HTTP::Cache::Transparent
install IO::Stringy
install XML::LibXML

# If you're in Portugal:
install Unicode::UTF8simple

# Exit from the CPAN shell
exit

# Become yourself again (if you installed perl modules)
exit


cd
test -f installed/xmltv-0.5.44.tar.bz2 && mv installed/xmltv-0.5.44.tar.bz2 .
test ! -f xmltv-0.5.44.tar.bz2 &&
 wget http://download.sf.net/xmltv/xmltv-0.5.44.tar.bz2
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "xmltv-*" -exec rm -r {} \;
tar xjvf ~/xmltv-0.5.44.tar.bz2
cd xmltv-0.5.44
test $UID = 0 && chown -R root:root .
chmod -R u+w .
perl Makefile.PL PREFIX=/usr

# Here you can configure what to build.  You'll probably want to shut off
# grabbers for foreign countries.

make
make test

# Become root to install it
su

rm -f /usr/bin/tv_grab_na /usr/man/man1/tv_grab_na.1
find /usr/doc -maxdepth 1 -type d -name "xmltv-*" -exec rm -r {} \;
make install

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/xmltv-*.tar.*
mv xmltv-0.5.44.tar.bz2 installed/

# As of version 0.5.31, the new grabber for North America (minus Mexico) is
# tv_grab_na_dd.  It's faster and it puts less of a load on Zap2it's servers
# (which is where the actual info comes from).  See it's man page for
# instructions on how to set it up.  You need to sign up for an account on
# their web site for this one.  As of version 0.5.33, tv_grab_na is no longer
# included in the distribution.  If you have any old
# ~/.xmltv/tv_grab_na.conf files lying around, you can remove those.

# Set up your grabber.  Keep in mind that (obviously) the more it grabs, the
# longer it'll take to run.  You may want to leave out channels that you don't
# watch to speed it up.  If you use the tv_grab_na_dd grabber, you can
# configure the channels from the web site (or the grabber, but probably
# better to use the web site).  You should run this as the non-root user that
# you'll be checking listings with later.  I run through this each time I
# upgrade too, to make sure it's updated for any new features or fixes.
tv_grab_na_dd --configure

# To configure tv_check, run 'tv_check --configure' from an X-Term

# If you want to use tv_pick_cgi, run this (or something similar to this)
# part.  It will install it under a standard apache2 or apache tree so it'll
# be accessible as http://localhost/cgi-bin/tv_pick/tv_pick.cgi
# Run your grabber and have it output listings to:
# /usr/local/apache/cgi-bin/tv_pick/tv.xml (or /usr/local/apache2/...).
test -d /usr/local/apache2 &&
 ( install -d -o root -g nobody -m 770 /usr/local/apache2/cgi-bin/tv_pick
   cd /usr/local/src/xmltv-0.5.44
   install -o root -g nobody -m 750 \
    /usr/local/src/xmltv-0.5.44/choose/tv_pick/tv_pick_cgi \
    /usr/local/apache2/cgi-bin/tv_pick/tv_pick.cgi )
test -d /usr/local/apache &&
 ( install -d -o root -g nobody -m 770 /usr/local/apache/cgi-bin/tv_pick
   cd /usr/local/src/xmltv-0.5.44
   install -o root -g nobody -m 750 \
    /usr/local/src/xmltv-0.5.44/choose/tv_pick/tv_pick_cgi \
    /usr/local/apache/cgi-bin/tv_pick/tv_pick.cgi )

## To save the listings somewhere, because the grabber will dump to stdout,
## run it like this:
# tv_grab_na_dd > na.xml

# See 'man tv_grab_na_dd' (or whatever grabber you use) for commandline
# switches.  There are lots to control number of days of listings, where to
# output them, etc.  Once you've got the listings, you can then split them
# up by date and channel (tv_split), grep through them (tv_grep), convert them
# to text (tv_to_text), and so on.

# If you use tv_grab_na_dd and want to include icons in your listings,
# create the /usr/share/xmltv/icons directory (as root) and run
# tv_grab_na_icons

# If you want a GUI to browse through the TV listings, check out Freeguide-TV

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>