#!/usr/bin/perl -w # # This script is a very butchered script to grab ontv listings # use strict; use LWP::Simple; use Getopt::Long; use XML::Writer; use IO::File; use XMLTV; use XMLTV::Memoize; use XMLTV::Usage < \$opt_days, 'help' => \$opt_help, 'output=s' => \$opt_output, 'channels=s' => \$opt_channels, 'configure' => \$opt_configure, 'config-file=s' => \$opt_configfile, 'offset=s' => \$opt_ignore) or usage(0); usage(1) if $opt_help; if (defined $opt_output) { $fh = new IO::File (">$opt_output"); die "cannot write to $opt_output\n" if not $fh; }; if (defined $opt_configure) { $fh = new IO::File (">$opt_configfile"); print $fh "channel 1 TV 1\n"; undef $fh; } $document = get("http://ontv.orcon.net.nz/listings.xml"); if (defined $opt_output) { print $fh $document; undef $fh; } else { print $document; };