SOURCES: xmltv-tv_grab_ee.patch - update with http://www.version6....

glen glen at pld-linux.org
Fri Sep 22 00:26:28 CEST 2006


Author: glen                         Date: Thu Sep 21 22:26:28 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update with http://www.version6.net/patches/tv_grab_ee-20060918.diff

---- Files affected:
SOURCES:
   xmltv-tv_grab_ee.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/xmltv-tv_grab_ee.patch
diff -u SOURCES/xmltv-tv_grab_ee.patch:1.1 SOURCES/xmltv-tv_grab_ee.patch:1.2
--- SOURCES/xmltv-tv_grab_ee.patch:1.1	Fri Sep 22 00:20:10 2006
+++ SOURCES/xmltv-tv_grab_ee.patch	Fri Sep 22 00:26:23 2006
@@ -1,25 +1,78 @@
---- xmltv-0.5.41/grab/ee/tv_grab_ee	2005-10-21 09:01:08.000000000 +0300
-+++ xmltv-0.5.41/grab/ee/tv_grab_ee	2006-09-18 00:28:54.000000000 +0300
-@@ -10,24 +13,34 @@
+Index: grab/ee/test.conf
+===================================================================
+RCS file: /cvsroot/xmltv/xmltv/grab/ee/test.conf,v
+retrieving revision 1.1
+diff -u -r1.1 test.conf
+--- grab/ee/test.conf	27 Dec 2005 12:44:19 -0000	1.1
++++ grab/ee/test.conf	17 Sep 2006 21:28:14 -0000
+@@ -1,31 +1,9 @@
+-channel 49.tv.delfi.ee NTV Sport
+-channel 10.tv.delfi.ee ETV
+-channel 32.tv.delfi.ee Viasat Explorer
+-#channel 47.tv.delfi.ee Viva
+-#channel 37.tv.delfi.ee NTV Discovery
+-#channel 20.tv.delfi.ee Nelonen
+-#channel 50.tv.delfi.ee NTV Jalgpall
+-#channel 14.tv.delfi.ee STV
+-#channel 43.tv.delfi.ee Arte
+-#channel 38.tv.delfi.ee Discovery Travel&Living
+-#channel 35.tv.delfi.ee TV3+
+-#channel 39.tv.delfi.ee Discovery Civilisation
+-#channel 23.tv.delfi.ee NTV+ Vene
+-#channel 13.tv.delfi.ee Kanal 2
+-#channel 44.tv.delfi.ee Eurosport
+-#channel 40.tv.delfi.ee Discovery Science
+-#channel 27.tv.delfi.ee PBK
+-#channel 45.tv.delfi.ee MTV
+-#channel 17.tv.delfi.ee MTV 3
+-#channel 24.tv.delfi.ee RTL2
+-#channel 25.tv.delfi.ee RTL
+-#channel 46.tv.delfi.ee VH1
+-#channel 41.tv.delfi.ee National Geographic
+-#channel 15.tv.delfi.ee YLE 1
+-#channel 12.tv.delfi.ee TV 3
+-#channel 42.tv.delfi.ee Viasat History
+-#channel 36.tv.delfi.ee Discovery Channel
+-#channel 22.tv.delfi.ee PRO 7
+-#channel 48.tv.delfi.ee Mezzo
+-#channel 16.tv.delfi.ee YLE 2
+-#channel 29.tv.delfi.ee TV1000 Eesti
++root-url=http://xmltv.kava.ee/files
++channel=11.xmltv.kava.ee
++channel=12.xmltv.kava.ee
++channel=13.xmltv.kava.ee
++channel!15.xmltv.kava.ee
++channel!16.xmltv.kava.ee
++channel!17.xmltv.kava.ee
++channel!18.xmltv.kava.ee
++channel!81.xmltv.kava.ee
+Index: grab/ee/tv_grab_ee
+===================================================================
+RCS file: /cvsroot/xmltv/xmltv/grab/ee/tv_grab_ee,v
+retrieving revision 1.7
+diff -u -r1.7 tv_grab_ee
+--- grab/ee/tv_grab_ee	12 Apr 2006 08:19:16 -0000	1.7
++++ grab/ee/tv_grab_ee	17 Sep 2006 21:28:14 -0000
+@@ -10,12 +10,14 @@
  
  tv_grab_ee --help
  
 -tv_grab_ee [--config-file FILE] --configure [--gui OPTION]
 +tv_grab_ee --configure [--config-file FILE] [--gui OPTION]
-+
+ 
+-tv_grab_ee [--config-file FILE] [--output FILE] [--days N]
+-           [--offset N] [--quiet]
 +tv_grab_ee [--config-file FILE]
 +           [--days N] [--offset N]
 +           [--output FILE] [--quiet] [--debug]
-+
+ 
+-tv_grab_ee --list-channels
 +tv_grab_ee --list-channels  [--config-file FILE]
 +           [--output FILE] [--quiet] [--debug]
  
--tv_grab_ee [--config-file FILE] [--output FILE] [--days N]
--           [--offset N] [--quiet]
-+tv_grab_ee --capabilities
+ tv_grab_ee --capabilities
  
--tv_grab_ee --list-channels
-+tv_grab_ee --version
+@@ -23,15 +25,19 @@
  
  =head1 DESCRIPTION
  
@@ -27,63 +80,57 @@
 -The data comes from http://ajaviide.delfi.ee/events/tv/.
 +Output TV listings in XMLTV format for many stations available in Estonia.
 +The data comes from www.kava.ee.
-+
-+First you must run B<tv_grab_ee --configure> to choose which stations
-+you want to receive.
-+
-+Then running B<tv_grab_ee> with no arguments will get a listings in XML
-+format for the stations you chose for available days including today.
  
 -First run B<tv_grab_ee --configure> to choose, which channels you want
 -to download. Then running B<tv_grab_ee> with no arguments will output
 -listings in XML format to standard output.
-+=head1 OPTIONS
++First you must run B<tv_grab_ee --configure> to choose which stations
++you want to receive.
  
 -B<--configure> Prompt for which channels,
 -and write the configuration file.
++Then running B<tv_grab_ee> with no arguments will get a listings in XML
++format for the stations you chose for available days including today.
++
++=head1 OPTIONS
++
 +B<--configure> Prompt for which stations to download and write the
 +configuration file.
  
  B<--config-file FILE> Set the name of the configuration file, the
  default is B<~/.xmltv/tv_grab_ee.conf>.  This is the file written by
-@@ -38,256 +51,312 @@
+@@ -42,15 +48,17 @@
  Additional allowed values of OPTION are 'Term' for normal terminal output
  (default) and 'TermNoProgressBar' to disable the use of XMLTV::ProgressBar.
  
--B<--output FILE> write to FILE rather than standard output.
+-B<--output FILE> Write to FILE rather than standard output.
 +B<--output FILE> When grabbing, write output to FILE rather than
 +standard output.
  
--B<--days N> grab N days.  The default is -1 which means everything
+-B<--days N> Grab N days.  The default is -1 which means everything
 +B<--days N> When grabbing, grab N days rather than all available days.
  
--B<--offset N> start N days in the future.  The default is to start
+-B<--offset N> Start N days in the future.  The default is to start
 -from today.
 +B<--offset N> Start grabbing at today + N days.  N may be negative.
  
--B<--quiet> suppress the progress messages normally written to standard
+-B<--quiet> Suppress the progress messages normally written to standard
 -error.
 +B<--quiet> Suppress the progress-bar normally shown on standard error.
- 
--B<--list-channels> write output giving <channel> elements for every
++
 +B<--debug> Provide more information on progress to stderr to help in
 +debugging.
-+
-+B<--list-channels> Write output giving <channel> elements for every
+ 
+ B<--list-channels> Write output giving <channel> elements for every
  channel available (ignoring the config file), but no programmes.
+@@ -62,268 +70,290 @@
  
--B<--help> print a help message and exit.
-+B<--capabilities> Show which capabilities the grabber supports. For more
-+information, see L<http://membled.com/twiki/bin/view/Main/XmltvCapabilities>
+ B<--help> Print a help message and exit.
  
 -=head1 SEE ALSO
-+B<--version> Show the version of the grabber.
++=head1 ERROR HANDLING
  
 -L<xmltv(5)>.
-+B<--help> Print a help message and exit.
-+
-+=head1 ERROR HANDLING
-+
 +If the grabber fails to download data for some channel on a specific day, 
 +it will print an errormessage to STDERR and then continue with the other
 +channels and days. The grabber will exit with a status code of 1 to indicate 
@@ -121,50 +168,26 @@
 +my $default_root_url = 'http://xmltv.kava.ee/files';
  
  use strict;
+-use XMLTV::Version '$Id$ ';
+-use XMLTV::Capabilities qw/baseline manualconfig cache/;
+-use XMLTV::Description 'Estonia';
 -use Getopt::Long;
 -use LWP::Simple;
 -use Time::Local;
+-use Date::Manip;
  
  use XMLTV;
 -use XMLTV::Ask;
 -use XMLTV::Config_file;
 -use XMLTV::Mode;
 -use XMLTV::Date;
--
--my $xmlstr;
--my $xmldata;
--
--my %channels;
--my ($encoding, $credits, $ch, $progs);
--
--my $ds1;		# start timestamp YYYYMMDD
--my $ds2;		# end + 1 day
--
--my $opt_days = -1;	# return all data
--my $opt_offset = 0;
--my $opt_help;
--my $opt_configure;
--my $opt_config_file;
--my $opt_gui;
--my $opt_output;
--my $opt_quiet = 0;
--my $opt_list_channels;
--
--my $bar;
--
--use XMLTV::Usage <<END
--$0: get Estonian television listings in XMLTV format
--To configure: $0 --configure [--config-file FILE]
--To grab listings: $0 [--config-file FILE] [--output FILE] [--days N]
--        [--offset N]
--To list channels: $0 --list-channels
--END
--;
 +use XMLTV::ProgressBar;
 +use XMLTV::Options qw/ParseOptions/;
 +use XMLTV::Configure::Writer;
-+use XMLTV::Memoize; XMLTV::Memoize::check_argv 'get';
-+
+ use XMLTV::Memoize; XMLTV::Memoize::check_argv 'get';
+ 
+-my $xmlstr;
+-my $xmldata;
 +use XML::LibXML;
 +use Date::Manip;
 +use Compress::Zlib;
@@ -245,39 +268,68 @@
 +
 +$data->[1]{'generator-info-name'} = '$Id$ ';
 +$data->[1]{'generator-info-url'} = 'mailto:cougar at random.ee';
- 
--sub get_xmlstr
-+XMLTV::write_data($data, %w_args);
 +
++XMLTV::write_data($data, %w_args);
+ 
+-my %channels;
+-my ($encoding, $credits, $ch, $progs);
 +# Signal that something went wrong if there were warnings.
 +exit(1) if $warnings;
-+
+ 
+-my $ds1;		# start timestamp YYYYMMDD
+-my $ds2;		# end + 1 day
 +# All data fetched ok.
 +t 'Exiting without warnings.';
 +exit(0);
-+
+ 
+-my $opt_days = -1;	# return all data
+-my $opt_offset = 0;
+-my $opt_help;
+-my $opt_configure;
+-my $opt_config_file;
+-my $opt_gui;
+-my $opt_output;
+-my $opt_quiet = 0;
+-my $opt_list_channels;
+-
+-my $bar;
+-
+-use XMLTV::Usage <<END
+-$0: get Estonian television listings in XMLTV format
+-To configure: $0 --configure [--config-file FILE]
+-To grab listings: $0 [--config-file FILE] [--output FILE] [--days N]
+-        [--offset N]
+-To list channels: $0 --list-channels
+-To show capabilities: $0 --capabilities
+-To show version: $0 --version
+-END
+-;
 +##############################################################################
-+
+ 
+-sub get_xmlstr
 +sub t
  {
 -	$xmlstr = get($xmlurl);
 -	die "get_xmldata: could not open \"$xmlurl\": $!" unless defined $xmlstr;
 +	my ($message) = @_;
 +	print STDERR $message . "\n" if $opt->{debug};
- }
++}
  
--sub parse_xmlstr
+-	# Correct occasional malformed data on site.
+-	$xmlstr =~ s!<desc lang="et"></desc>!!g;
+-	return $xmlstr;
 +sub warning
- {
--	$xmldata = XMLTV::parse($xmlstr);
--	($encoding, $credits, $ch, $progs) = @$xmldata;
++{
 +	my ($message) = @_;
 +	print STDERR $message . "\n";
 +	$warnings++;
-+}
-+
+ }
+ 
+-sub parse_xmlstr
 +sub fetch_channels
-+{
+ {
+-	$xmldata = XMLTV::parse($xmlstr);
+-	($encoding, $credits, $ch, $progs) = @$xmldata;
 +	my ($conf) = @_;
 +
 +	t 'Fetching channels';
@@ -320,8 +372,24 @@
 -
 -	if (! defined $opt_list_channels) {
 -		foreach (@$progs) {
--			next unless (defined $channels{$_->{'channel'}});
--			next unless (&checktime($_->{'start'}));
+-			my ($start, $stop, $channel)
+-			  = ($_->{start}, $_->{stop}, $_->{channel});
+-			next unless (defined $channels{$channel});
+-			next unless (&checktime($start));
+-
+-			# Occasionally the upstream data has
+-			# programmes that stop before they start!
+-			#
+-			if (defined $stop) {
+-				my $start_parsed = ParseDate $start;
+-				die "bad start time $start" if not $start_parsed;
+-				my $stop_parsed = ParseDate $stop;
+-				die "bad stop time $stop" if not $stop_parsed;
+-				if (Date_Cmp($start_parsed, $stop_parsed) > 0) {
+-					warn "stop time $stop later than start time $start on $channel - blanking out stop time\n";
+-					undef $_->{stop};
+-				}
+-			}
 -			$writer->write_programme($_);
 -		}
 -	}
@@ -459,8 +527,6 @@
 +				   ],
 +		default		=> $default_root_url,
 +	});
-+
-+	$writer->end('select-channels');
  
 -	close CONF or warn "cannot close $config_file: $!";
 -	say("Finished configuration.");
@@ -479,6 +545,8 @@
 -			my $ch_name = $2;
 -			$ch_name =~ s/\s*$//;
 -			$channels{$ch_did} = $ch_name;
++	$writer->end('select-channels');
++
 +	return $result;
 +}
 +
@@ -560,3 +628,66 @@
 -	die
 +	return $conf;
  }
+Index: lib/Configure.pm
+===================================================================
+RCS file: /cvsroot/xmltv/xmltv/lib/Configure.pm,v
+retrieving revision 1.4
+diff -u -r1.4 Configure.pm
+--- lib/Configure.pm	16 Mar 2006 17:48:19 -0000	1.4
++++ lib/Configure.pm	17 Sep 2006 21:28:15 -0000
+@@ -190,6 +190,8 @@
+     my $xml = XML::LibXML->new;
+     my $doc = $xml->parse_string($stage);
+     
++    binmode(STDERR, ":utf8") if ($doc->encoding eq "utf-8");
++
+     my $ns = $doc->find( "//xmltvconfiguration/*" );
+   
+     foreach my $p ($ns->get_nodelist)
+@@ -322,12 +324,13 @@
+     my $xml = XML::LibXML->new;
+     my $doc;
+     $doc = $xml->parse_string($channels);
++    my $encoding = $doc->encoding;
+     
+     my $ns = $doc->find( "//channel" );
+ 
+     my $result;
+     my $writer = new XMLTV::Configure::Writer( OUTPUT => \$result,
+-					       encoding => 'iso-8859-1' );
++					       encoding => $encoding );
+     $writer->start( { grabber => $grabber_name } );
+     $writer->start_selectmany( {
+ 	id => 'channel', 
+Index: lib/Options.pm
+===================================================================
+RCS file: /cvsroot/xmltv/xmltv/lib/Options.pm,v
+retrieving revision 1.11
+diff -u -r1.11 Options.pm
+--- lib/Options.pm	3 Jun 2006 19:36:52 -0000	1.11
++++ lib/Options.pm	17 Sep 2006 21:28:15 -0000
+@@ -2,6 +2,7 @@
+ 
+ use strict;
+ use warnings;
++use vars qw($fd);
+ 
+ BEGIN {
+     use Exporter   ();
+@@ -341,14 +342,14 @@
+ 
+     if( defined( $opt->{output} ) )
+     {
+-	if( not open( OUT, "> $opt->{output}" ) )
++	if( not open( $fd, "> $opt->{output}" ) )
+ 	{
+ 	    print STDERR "Cannot write to $opt->{output}.";
+ 	    exit 1;
+ 	}
+ 	
+ 	# Redirect STDOUT to the file.
+-	select( OUT );
++	select( $fd );
+     }
+ 
+     if( $opt->{configure} )
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/xmltv-tv_grab_ee.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list