Update of /cvsroot/xmltv/xmltv/grab/uk_rt
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8430/grab/uk_rt
Modified Files:
tv_grab_uk_rt.in
Log Message:
Reduces the number of situations in which the grabber will terminate prematurely. We now skip any entries that are malformed or missing but would otherwise allow the grabber to continue, instead of immediately invoking die(). Debug output details any config entries/channels/programmes that have been skipped during execution. Only those situations deemed fatal to the grabber (e.g. missing Radio Times or XMLTV supplement file data, or a missing config file) will now result in a premature exit.
Index: tv_grab_uk_rt.in
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_rt/tv_grab_uk_rt.in,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -d -r1.162 -r1.163
*** tv_grab_uk_rt.in 28 Mar 2008 08:53:29 -0000 1.162
--- tv_grab_uk_rt.in 28 Mar 2008 12:52:59 -0000 1.163
***************
*** 235,239 ****
$num_ts_channels, $num_pt_channels);
! t("\nExtended channel information:");
XMLTV_CHANID_ENTRY:
--- 235,239 ----
$num_ts_channels, $num_pt_channels);
! t("\nExtended channel information:\n");
XMLTV_CHANID_ENTRY:
***************
*** 245,250 ****
# No check on maximum number of fields to support future updates
# to channel_ids now we are using XMLTV::Supplement
! die "Error: Wrong number of fields in XMLTV channel_ids file.\n\n"
! . "Please update XMLTV to the current version." if (@fields < 2);
# The channel_ids fields are:
--- 245,252 ----
# No check on maximum number of fields to support future updates
# to channel_ids now we are using XMLTV::Supplement
! if (scalar @fields < 2) {
! t("Wrong number of fields in XMLTV channel_ids entry '$line'.");
! next XMLTV_CHANID_ENTRY;
! }
# The channel_ids fields are:
***************
*** 263,269 ****
# Check for required XMLTV ID and RT ID fields, skip if missing
if ($xmltv_id !~ /\w+\.\w+.*/ || $rt_id !~ /^\d+$/) {
! if (!$opt_quiet) {
! say("Invalid XMLTV ID or RT ID seen in channel_ids");
! }
next XMLTV_CHANID_ENTRY;
}
--- 265,269 ----
# Check for required XMLTV ID and RT ID fields, skip if missing
if ($xmltv_id !~ /\w+\.\w+.*/ || $rt_id !~ /^\d+$/) {
! t("Invalid XMLTV ID or RT ID seen in channel_ids");
next XMLTV_CHANID_ENTRY;
}
***************
*** 423,427 ****
}
- #FIXME
if (!$opt_quiet) {
say("\nThe XMLTV tv_grab_uk_rt software has support for $num_good_channels\n"
--- 423,426 ----
***************
*** 471,480 ****
foreach my $rt_channel (@rt_channels) {
chomp $rt_channel;
! die "Bad channel entry seen in RT channels.dat: $rt_channel"
! if ($rt_channel !~ /^(\d+)\|(.+)/);
my ($rt_id, $rt_name) = ($1, $2);
! die "Duplicate channnel ID '$rt_id' seen in RT channels.dat, aborting"
! if ($seen_rt_id{$rt_id}++);
if ($seen_name{$rt_name}++) {
--- 470,483 ----
foreach my $rt_channel (@rt_channels) {
chomp $rt_channel;
! if ($rt_channel !~ /^(\d+)\|(.+)/) {
! t("Bad channel entry seen in RT channels.dat: $rt_channel, skipping");
! next RT_CHANDAT_ENTRY;
! }
my ($rt_id, $rt_name) = ($1, $2);
! if ($seen_rt_id{$rt_id}++) {
! t("Duplicate channnel ID '$rt_id' seen in RT channels.dat, skipping");
! next RT_CHANDAT_ENTRY;
! }
if ($seen_name{$rt_name}++) {
***************
*** 674,686 ****
++$n;
next CONFIG_ENTRY if (!defined $config_entry);
! die "$config_file: $n: bad line $config_entry\n"
! if ($config_entry !~ /^\s*channel\s+(\S+)\s*$/);
my $id = $1;
t(" Read channel '$id'");
if (!exists $channels{$id}) {
! if (!$opt_quiet) {
! say(" XMLTV channel '$id' mentioned in $config_file but is "
! . "not available on RT site\n");
! }
next CONFIG_ENTRY;
}
--- 677,690 ----
++$n;
next CONFIG_ENTRY if (!defined $config_entry);
! next CONFIG_ENTRY if ($config_entry =~ '^#' || $config_entry =~ '^$');
! if ($config_entry !~ /^\s*channel\s+(\S+)\s*$/) {
! t("$config_file: $n: bad line '$config_entry'\n");
! next CONFIG_ENTRY;
! }
my $id = $1;
t(" Read channel '$id'");
if (!exists $channels{$id}) {
! t(" XMLTV channel '$id' mentioned in $config_file but is "
! . "not available on RT site\n");
next CONFIG_ENTRY;
}
***************
*** 774,778 ****
my $rt_id = $c->{rt_id};
my $rt_name = $c->{'display-name'}->[0]->[0];
! die "No Radio Times ID for channel '$rt_name'" if (!defined $rt_id);
t("\nProcessing listings for '$rt_name' ($xmltv_id)");
--- 778,785 ----
my $rt_id = $c->{rt_id};
my $rt_name = $c->{'display-name'}->[0]->[0];
! if (!defined $rt_id) {
! t("No Radio Times ID for channel '$rt_name', skipping");
! next WANTED_CH;
! }
t("\nProcessing listings for '$rt_name' ($xmltv_id)");
***************
*** 930,947 ****
) = @fields;
foreach my $field ($premiere, $film, $repeat,
$subtitles, $widescreen, $new_series,
$deaf_signed, $black_and_white, $choice, ) {
! die "true/false value not defined" if (!defined $field);
if ($field eq 'true') { $field = 1; }
elsif ($field eq 'false') { $field = 0; }
! else { die "bad true/false value $field"; }
! }
!
! t(" Processing programme title '$title'");
!
! if (!defined $title) {
! t(" Missing title in '$prog', skipping entry\n");
! next PROGRAMME;
}
--- 937,964 ----
) = @fields;
+ if (!defined $title) {
+ t(" Missing title in '$prog', skipping");
+ next PROGRAMME;
+ }
+ t(" Processing programme title '$title'");
+
+ if (!defined $date) {
+ t(" Missing date in '$prog', skipping");
+ next PROGRAMME;
+ }
+
foreach my $field ($premiere, $film, $repeat,
$subtitles, $widescreen, $new_series,
$deaf_signed, $black_and_white, $choice, ) {
! if (!defined $field) {
! t(" A required true/false value was undefined for '$title', skipping");
! next PROGRAMME;
! }
if ($field eq 'true') { $field = 1; }
elsif ($field eq 'false') { $field = 0; }
! else {
! t(" A bad true/false value '$field' was seen for '$title', skipping");
! next PROGRAMME;
! }
}
***************
*** 1236,1241 ****
my $implicit_tz;
! die "Missing date in $date" if (!defined $date);
! die "Bad date $date" if ($date !~ m{(\d\d)/(\d\d)/(\d{4})$});
($dd, $mm, $yyyy) = ($1, $2, $3);
--- 1253,1260 ----
my $implicit_tz;
! if ($date !~ m{(\d\d)/(\d\d)/(\d{4})$}) {
! t(" A bad date '$date' was seen for '$title', skipping");
! next PROGRAMME;
! }
($dd, $mm, $yyyy) = ($1, $2, $3);
***************
*** 1289,1293 ****
# UTC offset to use for this programme's start/stop times
$p{start} = utc_offset( "$yyyy$mm$dd$start", $base_tz );
! die "Bad UTC offset for programme $title" if ($p{start} !~ /([+-]\d{4})$/);
$implicit_tz = $1;
t(" Implicit timezone calculated to be '$implicit_tz'");
--- 1308,1315 ----
# UTC offset to use for this programme's start/stop times
$p{start} = utc_offset( "$yyyy$mm$dd$start", $base_tz );
! if ($p{start} !~ /([+-]\d{4})$/) {
! t(" Bad UTC offset '$1' detected for '$title', skipping");
! next PROGRAMME;
! }
$implicit_tz = $1;
t(" Implicit timezone calculated to be '$implicit_tz'");
|