xmltv/grab/uk_guardian CHANGELOG, 1.4, 1.5 tv_grab_uk_guardian, 1.5, 1.6
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/uk_guardian
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23540
Modified Files:
CHANGELOG tv_grab_uk_guardian
Log Message:
Use new Supplement methods
(minor) General code tidy-up
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_guardian/CHANGELOG,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CHANGELOG 6 Dec 2013 13:44:30 -0000 1.4
--- CHANGELOG 8 Jan 2014 13:08:53 -0000 1.5
***************
*** 1,3 ****
! 1.5 6-Dec-2013 Workaround for fault in The Guardian's website
1.4 20-Oct-2013 Minor code change
1.3 20-Oct-2013 Minor bug fix for nightly validator
--- 1,4 ----
! 1.6 8-Jan-2014 Use new Supplement methods & General code tidy-up
! 1.5 6-Dec-2013 Workaround for fault in The Guardian's website
1.4 20-Oct-2013 Minor code change
1.3 20-Oct-2013 Minor bug fix for nightly validator
Index: tv_grab_uk_guardian
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_guardian/tv_grab_uk_guardian,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tv_grab_uk_guardian 6 Dec 2013 13:42:41 -0000 1.5
--- tv_grab_uk_guardian 8 Jan 2014 13:08:53 -0000 1.6
***************
*** 20,24 ****
use XMLTV::Options qw/ParseOptions/;
use XMLTV::Configure::Writer;
! use XMLTV::Get_nice qw(get_nice_tree);
use File::Path;
--- 20,25 ----
use XMLTV::Options qw/ParseOptions/;
use XMLTV::Configure::Writer;
! use XMLTV::Supplement 0.005065 qw/SetSupplementRoot GetSupplementDir GetSupplementLines/;
! use XMLTV::Get_nice qw/get_nice_tree/;
use File::Path;
***************
*** 35,39 ****
use XMLTV::Memoize; XMLTV::Memoize::check_argv('XMLTV::Get_nice::get_nice_aux');
! use subs qw(t warning);
my $warnings = 0;
--- 36,40 ----
use XMLTV::Memoize; XMLTV::Memoize::check_argv('XMLTV::Get_nice::get_nice_aux');
! use subs qw(debug warning);
my $warnings = 0;
***************
*** 162,166 ****
# All data fetched ok.
! t "Exiting without warnings.";
exit(0);
--- 163,167 ----
# All data fetched ok.
! debug "Exiting without warnings.";
exit(0);
***************
*** 189,193 ****
# my $url = $baseurl . '&tvgDayOffset=' . $i . 'f' . '&tvgChannelName=' . $channel_id;
my $url = $baseurl . '&tvgDayOffset=' . $i . 'f' . '&c=' . $channel_id;
! # print $url ."\n";
# If we need to map the fetched channel_id to a different value
--- 190,194 ----
# my $url = $baseurl . '&tvgDayOffset=' . $i . 'f' . '&tvgChannelName=' . $channel_id;
my $url = $baseurl . '&tvgDayOffset=' . $i . 'f' . '&c=' . $channel_id;
! #debug "Fetching: $url";
# If we need to map the fetched channel_id to a different value
***************
*** 219,223 ****
my $channeltitle = $tree->look_down('_tag' => 'title')->as_text;
$channeltitle =~ m/^(.*)\sTV listings/ and $channeltitle = $1;
! print STDERR "TITLE= ".$channeltitle."\n" if $opt->{debug};
# get the channel schedule(s) name
--- 220,224 ----
my $channeltitle = $tree->look_down('_tag' => 'title')->as_text;
$channeltitle =~ m/^(.*)\sTV listings/ and $channeltitle = $1;
! debug "TITLE= ".$channeltitle;
# get the channel schedule(s) name
***************
*** 225,236 ****
my $channelsched;
foreach (@channelscheds) {
! print STDERR $_->as_text."\n" if $opt->{debug};
next if ($_->as_text !~ m/\Q$channeltitle - channel number/);
! print STDERR "FOUND= ".$_->as_text."\n" if $opt->{debug};
$channelsched = $_;
last;
}
my $channelname = $channelsched->as_text;
! print STDERR $channelname."\n" if $opt->{debug};
# build the schedule from all the right nodes until we hit another 'tvg_channelname'
--- 226,237 ----
my $channelsched;
foreach (@channelscheds) {
! debug $_->as_text;
next if ($_->as_text !~ m/\Q$channeltitle - channel number/);
! debug "FOUND= ".$_->as_text;
$channelsched = $_;
last;
}
my $channelname = $channelsched->as_text;
! debug $channelname;
# build the schedule from all the right nodes until we hit another 'tvg_channelname'
***************
*** 322,326 ****
$prog{'episode-num'} = [[ $showepnum, 'xmltv_ns' ]];
}
! #print "--$showepnum-- ".$showepisode->as_text."\n";
if ($showep) { $prog{'sub-title'} = [[ encode( 'utf-8', decode( 'windows-1255', $showep)), 'en']]; }
--- 323,327 ----
$prog{'episode-num'} = [[ $showepnum, 'xmltv_ns' ]];
}
! #debug "--$showepnum-- ".$showepisode->as_text;
if ($showep) { $prog{'sub-title'} = [[ encode( 'utf-8', decode( 'windows-1255', $showep)), 'en']]; }
***************
*** 334,338 ****
$directors =~ s/ (singer|actor|actress) //ig; # strip these words
$directors =~ s/,,/,/g; # delete empties
! #print $directors."\n";
my @directors = split(/,/, $directors);
s{^\s+|\s+$}{}g foreach @directors; # strip leading & trailing spaces
--- 335,339 ----
$directors =~ s/ (singer|actor|actress) //ig; # strip these words
$directors =~ s/,,/,/g; # delete empties
! #debug $directors;
my @directors = split(/,/, $directors);
s{^\s+|\s+$}{}g foreach @directors; # strip leading & trailing spaces
***************
*** 347,351 ****
$actors =~ s/ (singer|actor|actress) //ig; # strip these words
$actors =~ s/,,/,/g; # delete empties
! #print $actors."\n";
my @actors = split(/,/, $actors);
s{^\s+|\s+$}{}g foreach @actors; # strip leading & trailing spaces
--- 348,352 ----
$actors =~ s/ (singer|actor|actress) //ig; # strip these words
$actors =~ s/,,/,/g; # delete empties
! #debug $actors;
my @actors = split(/,/, $actors);
s{^\s+|\s+$}{}g foreach @actors; # strip leading & trailing spaces
***************
*** 354,358 ****
! # print Dumper \%prog;
push(@{$programmes}, \%prog);
--- 355,359 ----
! # debug Dumper \%prog;
push(@{$programmes}, \%prog);
***************
*** 388,392 ****
#
my ($s, $e, $e_of, $p, $p_of) = @_;
! # print Dumper(@_);
# "Part x of x" may contaain integers or words (e.g. "Part 1 of 2", or "Part one")
--- 389,393 ----
#
my ($s, $e, $e_of, $p, $p_of) = @_;
! # debug Dumper(@_);
# "Part x of x" may contaain integers or words (e.g. "Part 1 of 2", or "Part one")
***************
*** 409,413 ****
$episode_ns .= '/'.$p_of if defined $p_of;
! #print "--$episode_ns--";
return $episode_ns;
}
--- 410,414 ----
$episode_ns .= '/'.$p_of if defined $p_of;
! #debug "--$episode_ns--";
return $episode_ns;
}
***************
*** 462,482 ****
my $mapcategories = \%mapcategoryhash;
#
! my $fn = get_supplement_dir() . '/'. $GRABBER_NAME . '.map.conf';
! my $fhok = open my $fh, '<', $fn or warning("Cannot open conf file $fn");
! if ($fhok) {
! while (my $line = <$fh>) {
! chomp $line;
! chop($line) if ($line =~ m/\r$/);
! next if $line =~ /^#/ || $line eq '';
my ($type, $mapfrom, $mapto, $trash) = $line =~ /^(.*)==(.*)==(.*?)([\s\t]*#.*)?$/;
SWITCH: {
lc($type) eq 'map' && do { $mapchannels->{$mapfrom} = $mapto; last SWITCH; };
lc($type) eq 'cat' && do { $mapcategories->{$mapfrom} = $mapto; last SWITCH; };
! warning("Unknown type in map file: \n $line");
}
}
! close $fh;
! }
! # print Dumper ($mapchannels, $mapcategories);
}
--- 463,478 ----
my $mapcategories = \%mapcategoryhash;
#
! my $supplementdir = $ENV{XMLTV_SUPPLEMENT} || GetSupplementDir();
! SetSupplementRoot($supplementdir);
! my $lines = GetSupplementLines($GRABBER_NAME, $GRABBER_NAME . '.map.conf');
! foreach my $line (@$lines) {
my ($type, $mapfrom, $mapto, $trash) = $line =~ /^(.*)==(.*)==(.*?)([\s\t]*#.*)?$/;
SWITCH: {
lc($type) eq 'map' && do { $mapchannels->{$mapfrom} = $mapto; last SWITCH; };
lc($type) eq 'cat' && do { $mapcategories->{$mapfrom} = $mapto; last SWITCH; };
! warning "Unknown type in map file: \n $line";
}
}
! # debug Dumper ($mapchannels, $mapcategories);
}
***************
*** 502,507 ****
my $_channels = $tree->look_down('_tag' => 'span', 'id' => '_ctl0_main_channelList');
my @channels = $_channels->look_down('_tag' => 'a', 'href' => qr/$channel_link_regexp/);
! # print $_channels->as_HTML;
! # foreach my $xchannel (@channels) { print $xchannel->as_HTML; }
$bar->update() && $bar->finish && undef $bar if defined $bar;
--- 498,503 ----
my $_channels = $tree->look_down('_tag' => 'span', 'id' => '_ctl0_main_channelList');
my @channels = $_channels->look_down('_tag' => 'a', 'href' => qr/$channel_link_regexp/);
! # debug $_channels->as_HTML;
! # foreach my $xchannel (@channels) { debug $xchannel->as_HTML; }
$bar->update() && $bar->finish && undef $bar if defined $bar;
***************
*** 596,604 ****
}
- sub get_supplement_dir {
- return $ENV{XMLTV_SUPPLEMENT} . "/" . $GRABBER_NAME if defined( $ENV{XMLTV_SUPPLEMENT} );
- return get_default_dir() . "/.xmltv/supplement/" . $GRABBER_NAME;
- }
-
sub get_default_cachedir {
return get_default_dir() . "/.xmltv/cache";
--- 592,595 ----
***************
*** 621,630 ****
}
! sub t {
! my( $message ) = @_;
! print STDERR $message . "\n" if $opt->{debug};
}
! sub warning {
my( $message ) = @_;
print STDERR $message . "\n";
--- 612,622 ----
}
! sub debug ( $$ ) {
! my( $message, $nonewline ) = @_;
! print STDERR $message if $opt->{debug};
! print STDERR "\n" unless (defined $nonewline && $nonewline == 1);
}
! sub warning ( $ ) {
my( $message ) = @_;
print STDERR $message . "\n";
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk