xmltv/grab/za tv_grab_za,1.43,1.44
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/za
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7056
Modified Files:
tv_grab_za
Log Message:
Fix 'notadditive' error in tester
Fix --list-channels
Index: tv_grab_za
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/za/tv_grab_za,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** tv_grab_za 9 Dec 2013 16:59:02 -0000 1.43
--- tv_grab_za 11 Dec 2013 17:32:18 -0000 1.44
***************
*** 274,283 ****
# - stop time is optional according to the DTD).
#
! my %allowed_days = (1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
! die "--offset cannot be negative" if defined $opt_offset and $opt_offset < 0;
! die "--days must be positive" if defined $opt_days and $opt_days <= 0;
$opt_offset = 0 if !$opt_offset;
$opt_days = 7 if !$opt_days;
! $opt_days = min($opt_days, 8);
my $use_days = 0;
--- 274,286 ----
# - stop time is optional according to the DTD).
#
! my $max_days = 8;
$opt_offset = 0 if !$opt_offset;
$opt_days = 7 if !$opt_days;
! my %allowed_days = (1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8);
! die "--offset cannot be negative" if $opt_offset < 0;
! die "--days must be positive" if $opt_days <= 0;
! die "--days exceeds site availability ($max_days)" if $opt_days > $max_days;
! $opt_days = min($opt_days, $max_days);
! die "--offset ($opt_offset) plus --days ($opt_days) exceeds site availability ($max_days)" if ($opt_offset + $opt_days > $max_days);
my $use_days = 0;
***************
*** 341,344 ****
--- 344,348 ----
if ($mode eq 'list-channels') {
# Write channels mode.
+ get_channels(\%channels);
foreach my $id (keys %channels) {
$writer->write_channel({id => $id, 'display-name' => [ [ $channels{$id}, 'en' ] ]});
***************
*** 375,379 ****
}
! my $bar = new XMLTV::ProgressBar('getting listings', (scalar keys %channels) * $opt_days)
if not $opt_quiet;
--- 379,383 ----
}
! my $bar = new XMLTV::ProgressBar('getting listings', (scalar keys %channels) * min(($opt_days + 1),$max_days))
if not $opt_quiet;
***************
*** 819,823 ****
my ($data, $prev_r, $r);
! for (my $i=$opt_offset; $i < ($opt_offset + $opt_days); $i++) {
# get the page and parse to a document object
--- 823,834 ----
my ($data, $prev_r, $r);
! # For each day requested get the page and extract the programmes.
! # Listings don't have a duration or a stop time so we need to work "one behind"
! # (i.e. we can only write a show once we have the start time of the *next* show).
! # This means we need to grab an extra day to calculate the stop time of the last show.
! # (Obviously if the 'offset + days' exceeds the site limit (i.e. 8 days data) then we can't do this
! # and the last programme will be omitted from the xml).
!
! for (my $i=$opt_offset; $i <= ($opt_offset + $opt_days) && $i < $max_days; $i++) {
# get the page and parse to a document object
***************
*** 867,872 ****
# ??? sometimes it seems we get 'div' => 'ui-listings' but other times we get 'table' => 'ui-search-results' !!!
my $schedule = $tree->look_down(_tag => 'table', id => 'ui-search-results');
- #print STDERR 'could not find schedule'."\n" if !$schedule;
if (!$schedule) {
$schedule = $tree->look_down(_tag => 'div', id => 'ui-listings');
}
--- 878,883 ----
# ??? sometimes it seems we get 'div' => 'ui-listings' but other times we get 'table' => 'ui-search-results' !!!
my $schedule = $tree->look_down(_tag => 'table', id => 'ui-search-results');
if (!$schedule) {
+ #print STDERR 'could not find schedule'."\n" if !$schedule;
$schedule = $tree->look_down(_tag => 'div', id => 'ui-listings');
}
***************
*** 883,887 ****
my $rating;
if (defined $desc) {
! $rating = $1 if $desc =~ / \((13|16|18|PG|PG13|R18)\)$/; # any others? is there a better way (e.g. 2 numeric || 4 alpha-num)?
}
$desc =~ s/\Q($rating)// if $rating;
--- 894,898 ----
my $rating;
if (defined $desc) {
! $rating = $1 if $desc =~ / \((13|16|18|PG|PG13|R18|Family)\)$/; # any others? is there a better way (e.g. 2 numeric || 4 alpha-num)?
}
$desc =~ s/\Q($rating)// if $rating;
***************
*** 902,905 ****
--- 913,919 ----
$prev_r = $r;
+ # if we are here only to get the start time of the first programme, then we are done
+ if (($opt_offset + $opt_days) == $i) { last; }
+
}
$tree->delete;
***************
*** 907,913 ****
}
-
- # Can't write the last programme since we don't have a stop time or a duration
- # $writer->write_programme($prev_r) if $prev_r;
$data = "success";
--- 921,924 ----
------------------------------------------------------------------------------
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