Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: [PATCH] xmltv2vdr-1.0.5 vdr-1.3.x compatible (Was: Re: future of xmltv2vdr?)
* Gregoire Favre <Gregoire.Favre@freesurf.ch> [040309 21:35]:
Please try again with this one, I've diffed it from the original
xmltv2vdr.pl v1.0.5 :)
Just finished grabing the xmltv files and I got:
Scalar found where operator expected at ./xmltv2vdr.pl line 147, near ")
# But only if the event is not yet finished we consider the info complete
$chanevent"
(Missing operator before $chanevent?)
syntax error at ./xmltv2vdr.pl line 147, near ")
# But only if the event is not yet finished we consider the info complete
$chanevent "
BEGIN not safe after errors--compilation aborted at ./xmltv2vdr.pl line 243.
Thank for your work in supporting xmltv2vdr.pl :-)
Oh my gosh! Definitely, today is not my day.
I diff from the original to a not-yet-working copy of it.
I hope this time I've made it right...
Can you try yet again?
My apologies for all the troubles.
--
Javier Marcet <javier@marcet.info>
--- xmltv2vdr.pl.orig 2004-03-09 21:42:23.443670472 +0100
+++ xmltv2vdr.pl 2004-03-02 03:58:15.000000000 +0100
@@ -126,23 +126,54 @@
# Find XML events
+ $line_number=0;
foreach $xmlline (@xmllines)
{
+ $line_number++;
chomp $xmlline;
# New XML Program - doesn't handle split programs yet
- if ( ($xmlline =~ /\<programme/ ) && ( $xmlline =~ /$xmltv_channel_name/ ) && ( $xmlline !~ /clumpidx=\"1\/2\"/ ) && ( $chanevent == 0 ) )
+ if ( ($xmlline =~ /\<programme/ ) && ( $xmlline =~ /$xmltv_channel_name/ ) && ( $xmlline !~ /clumpidx=\"1\/2\"/ ) && ( ! $chanevent ) )
{
- $chanevent = 1;
- ( $null, $xmlst, $null, $xmlet, @null ) = split(/\"/, $xmlline);
+ ( $xmlst, $xmlet ) = (split(/\"/, $xmlline))[1,3];
$vdrst = &xmltime2vdr($xmlst);
$vdret = &xmltime2vdr($xmlet);
- $vdrdur = $vdret - $vdrst;
- $vdrid = $vdrst / 60 % 0xFFFF;
-
- # Send VDR Event
- SVDRPsend("E $vdrid $vdrst $vdrdur 0");
+ if ( $vdret )
+ # If we parsed an ending time from the line analyzed, we do not need to seek further
+ {
+ # But only if the event is not yet finished we consider the info complete
+ $chanevent = 1 if ( $vdret > time() );
+ }
+ else
+ # Oterwise, we have to rely on the start time of the next evemt, if there is such an event within our data
+ {
+ foreach $xmlline_next (@xmllines[$line_number..$#xmllines])
+ {
+ chomp $xmlline_next;
+ if ( ($xmlline_next =~ /\<programme/ ) && ( $xmlline_next =~ /$xmltv_channel_name/ ) && ( $xmlline_next !~ /clumpidx=\"1\/2\"/ ) )
+ # We found a future event from which we'll use the start time as ending time of our still studied one
+ {
+ $xmlet = (split(/\"/, $xmlline_next))[1];
+ $vdret = &xmltime2vdr($xmlet);
+ # Only if the event is not yet finished, that is, this next event
+ # has not started, we tag the info as complete
+ $chanevent = 1 if ( $vdret > time() );
+ # In any case, getting here means we found one future event, whether
+ # it already started or not, we must not look up any further
+ last;
+ }
+ }
+ }
+ if ( $chanevent )
+ # Only when we have complete info about an event, we send it to vdr
+ {
+ $vdrdur = $vdret - $vdrst;
+ $vdrid = $vdrst / 60 % 0xFFFF;
+
+ # Send VDR Event
+ SVDRPsend("E $vdrid $vdrst $vdrdur 0");
+ }
}
# XML Program Title
Home |
Main Index |
Thread Index