diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2008-06-25 17:21:37 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2008-06-25 17:21:37 +0000 |
| commit | b8d12917b48c92412b18c34f6d89cbb350abb3f6 (patch) | |
| tree | 4a5c4c51409bf88971d59f80ace9008863e0fddd | |
| parent | 3910dd623a1603520cb11646a2e4f6884c2461e2 (diff) | |
| download | xxv-b8d12917b48c92412b18c34f6d89cbb350abb3f6.tar.gz xxv-b8d12917b48c92412b18c34f6d89cbb350abb3f6.tar.bz2 | |
* RECORDS: ignore empty info.vdr
* KEYWORDS: Bugreport[14073] Ignore not well-formed (invalid token) xml data
| -rw-r--r-- | lib/XXV/MODULES/KEYWORDS.pm | 10 | ||||
| -rw-r--r-- | lib/XXV/MODULES/RECORDS.pm | 82 |
2 files changed, 51 insertions, 41 deletions
diff --git a/lib/XXV/MODULES/KEYWORDS.pm b/lib/XXV/MODULES/KEYWORDS.pm index d6f9df4..830229d 100644 --- a/lib/XXV/MODULES/KEYWORDS.pm +++ b/lib/XXV/MODULES/KEYWORDS.pm @@ -325,7 +325,15 @@ sub parsexml { $aux =~ s/(\r|\n)//sg; if($aux && $aux =~ /^<.*/ ) { - my $args = $self->{xml}->XMLin($aux, KeepRoot => 1 ); + my $args = eval { $self->{xml}->XMLin($aux, KeepRoot => 1 ) } ; + if ($@) { + if($Tools::VERBOSE >= 4) { + error sprintf("Can't parse xml data : %s - %s", $@, $aux); + } elsif($Tools::VERBOSE >= 2) { + error ("Can't parse xml data"); + } + return undef; + } if(defined $args && defined $args->{'xxv'} ) { if($self->{charset} eq 'UTF-8'){ diff --git a/lib/XXV/MODULES/RECORDS.pm b/lib/XXV/MODULES/RECORDS.pm index 284421d..7a0f292 100644 --- a/lib/XXV/MODULES/RECORDS.pm +++ b/lib/XXV/MODULES/RECORDS.pm @@ -1065,46 +1065,48 @@ sub readinfo { my $file = sprintf("%s/info.vdr", $path); if(-r $file) { my $text = load_file($file); - my $modC = main::getModule('CHANNELS'); - foreach my $zeile (split(/[\r\n]/, $text)) { - if($zeile =~ /^D\s+(.+)/s) { - $info->{description} = $1; - $info->{description} =~ s/\|/\r\n/g; # pipe used from vdr as linebreak - $info->{description} =~ s/^\s+//; # no leading white space - $info->{description} =~ s/\s+$//; # no trailing white space - } - elsif($zeile =~ /^C\s+(\S+)/s) { - $info->{channel} = $1; - $info->{type} = $modC->getChannelType($info->{channel}); - } - elsif($zeile =~ /^T\s+(.+)$/s) { - $info->{title} = $1; - } - elsif($zeile =~ /^S\s+(.+)$/s) { - $info->{subtitle} = $1; - } - elsif($zeile =~ /^V\s+(.+)$/s) { - $info->{vpstime} = $1; - } - elsif($zeile =~ /^X\s+1\s+(.+)$/s) { - $info->{video} = $1; - } - elsif($zeile =~ /^X\s+2\s+(.+)$/s) { - $info->{audio} .= "\n" if($info->{audio}); - $info->{audio} .= $1; - } - elsif($zeile =~ /^@\s+(.+)$/s) { - $info->{aux} = $1; - $info->{aux} =~ s/\|/\r\n/g; # pipe used from vdr as linebreak - $info->{aux} =~ s/^\s+//; # no leading white space - $info->{aux} =~ s/\s+$//; # no trailing white space - - my $xml = $obj->{keywords}->parsexml($info->{aux}); - # $info->{keywords} = $xml->{'autotimer'} - # if($xml && defined $xml->{'autotimer'} ); - $info->{keywords} = $xml->{'keywords'} - if($xml && defined $xml->{'keywords'} ); - } + if($text) { + my $modC = main::getModule('CHANNELS'); + foreach my $zeile (split(/[\r\n]/, $text)) { + if($zeile =~ /^D\s+(.+)/s) { + $info->{description} = $1; + $info->{description} =~ s/\|/\r\n/g; # pipe used from vdr as linebreak + $info->{description} =~ s/^\s+//; # no leading white space + $info->{description} =~ s/\s+$//; # no trailing white space + } + elsif($zeile =~ /^C\s+(\S+)/s) { + $info->{channel} = $1; + $info->{type} = $modC->getChannelType($info->{channel}); + } + elsif($zeile =~ /^T\s+(.+)$/s) { + $info->{title} = $1; + } + elsif($zeile =~ /^S\s+(.+)$/s) { + $info->{subtitle} = $1; + } + elsif($zeile =~ /^V\s+(.+)$/s) { + $info->{vpstime} = $1; + } + elsif($zeile =~ /^X\s+1\s+(.+)$/s) { + $info->{video} = $1; + } + elsif($zeile =~ /^X\s+2\s+(.+)$/s) { + $info->{audio} .= "\n" if($info->{audio}); + $info->{audio} .= $1; + } + elsif($zeile =~ /^@\s+(.+)$/s) { + $info->{aux} = $1; + $info->{aux} =~ s/\|/\r\n/g; # pipe used from vdr as linebreak + $info->{aux} =~ s/^\s+//; # no leading white space + $info->{aux} =~ s/\s+$//; # no trailing white space + + my $xml = $obj->{keywords}->parsexml($info->{aux}); + # $info->{keywords} = $xml->{'autotimer'} + # if($xml && defined $xml->{'autotimer'} ); + $info->{keywords} = $xml->{'keywords'} + if($xml && defined $xml->{'keywords'} ); + } + } } } return $info; |
