Legend:
- Unmodified
- Added
- Removed
-
shepherd
r33 r34 271 271 $comm .= " --debug" if ($debug); 272 272 $comm .= " @ARGV" if (@ARGV); 273 print "SHEPHERD: Excuting command: $comm\n"; 274 275 chdir "$GRABBER_DIR/$grabber/"; 276 system($comm); 277 chdir $CWD; 273 274 if ((defined $opt->{dontcallgrabbers}) && ($opt->{dontcallgrabbers})) { 275 printf "SHEPHERD: not calling grabber because of --dontcallgrabbers option, but will instead use existing $output\n"; 276 } else { 277 print "SHEPHERD: Excuting command: $comm\n"; 278 chdir "$GRABBER_DIR/$grabber/"; 279 system($comm); 280 chdir $CWD; 281 } 278 282 279 283 # soak up the data we just collected … … 737 741 next if ($field eq "stop_epoch"); 738 742 if (!defined $new_prog_entry->{$field}) { 739 printf "REC#5b: adding field \"%s\"\n",$field ;743 printf "REC#5b: adding field \"%s\"\n",$field if $recdebug; 740 744 $new_prog_entry->{$field} = $match_prog->{$field}; 741 745 # TODO (FUTURE): should we add to programme description to say where we got what data from? … … 745 749 } 746 750 751 # 747 752 # 6. write out new entry 753 # 754 748 755 printf "REC#6: writing out programme entry\n" if $recdebug; 749 #delete $new_prog_entry->{'start_epoch'};750 #delete $new_prog_entry->{'stop_epoch'};751 756 &cleanup($new_prog_entry); 757 758 # scrub programme for known bogosities 759 760 # oztivo typically inserts blank 'director' details into 'credits' .. scrub them 761 if ((defined $new_prog_entry->{'credits'}) && 762 (defined $new_prog_entry->{'credits'}->{'director'}) && 763 (defined $new_prog_entry->{'credits'}->{'director'}->[0])) { 764 my @director_list = $new_prog_entry->{'credits'}->{'director'}->[0]; 765 for my $i (0 .. $#director_list) { 766 delete $new_prog_entry->{'credits'}->{'director'}->[$i] if ((defined $director_list[$i]) && ($director_list[$i] eq "")); 767 } 768 } 769 770 # want to keep epoch start/stop for our own processing, but stop XMLTV whining about it in write_programme 771 # so temporarily remove them & reinsert them back afterwards 772 my ($orig_start_epoch,$orig_end_epoch) = ($new_prog_entry->{'start_epoch'},$new_prog_entry->{'stop_epoch'}); 773 delete $new_prog_entry->{'start_epoch'}; 774 delete $new_prog_entry->{'stop_epoch'}; 775 776 # write out 752 777 $writer->write_programme($new_prog_entry); 778 ($new_prog_entry->{'start_epoch'},$new_prog_entry->{'stop_epoch'}) = ($orig_start_epoch,$orig_end_epoch); 753 779 754 780 # 7a. remove all programmes that end before this endtime … … 823 849 my %amp; 824 850 BEGIN { %amp = ( nbsp => ' ', qw{ amp & lt < gt > apos ' quot " } ) } 851 825 852 sub cleanup { 826 853 my $x = shift; … … 829 856 elsif (ref $x eq "ARRAY") { cleanup(\$_) for @$x } 830 857 elsif (defined $$x) { 831 $$x =~ s/&(#(\d+)|(.*?));/ $2 ? chr($2) : $amp{$3}||' ' /eg; 832 # $$x =~ s/[^\x20-\x7f]/ /g; 833 $$x =~ s/(^\s+|\s+$)//g; 834 } 835 } 836 858 $$x =~ s/&(#(\d+)|(.*?));/ $2 ? chr($2) : $amp{$3}||' ' /eg; # scrub html 859 # $$x =~ s/[^\x20-\x7f]/ /g; # disabled (we want to keep non-std chars) 860 $$x =~ s/(^\s+|\s+$)//g; # strip leading/trailing spaces 861 } 862 } 837 863 838 864 # ----------------------------------------- … … 1339 1365 'configure' => \$opt->{configure}, 1340 1366 'mirror=s' => \$opt->{mirror}, 1367 'dontcallgrabbers' => \$opt->{dontcallgrabbers}, 1341 1368 'debug' => \$debug); 1342 1369 } … … 1581 1608 } else { 1582 1609 if (!ref($arg)) { 1583 CORE::die((sprintf "DIE at line %d in file %s: %s\n",$line,$file,(join("",($arg,@rest))))); 1610 printf STDERR "DIE at line %d in file %s\n",$line,$file; 1611 CORE::die(join("",@rest)); 1584 1612 } else { 1585 1613 CORE::die($arg,@rest);
