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 18:43]:
This time I send the patch attached, since the inlined version arrived
with broken lines...
For a strange reason, I can't patch with it:
patch -p0 --dry-run < xmltv2vdr-vdr1.3.patch
patching file xmltv2vdr.pl
Hunk #1 FAILED at 134.
Hunk #2 FAILED at 159.
2 out of 2 hunks FAILED -- saving rejects to file xmltv2vdr.pl.rej
Any idea why?
Yes sorry.
I patched it about a month ago and when I made the diff today I used thw
wrong base file.
Now I see why I remembered it having been a little more work than just
the couple lines I sent before.
Please try again with this one, I've diffed it from the original
xmltv2vdr.pl v1.0.5 :)
BTW, I intended to polish it a bit more, but after I got it working I
ended up doing other things in C++ and left it as it is.
In case it is still not working for you I'll take it again :)
--
Javier Marcet <javier@marcet.info>
--- xmltv2vdr.pl.orig 2003-05-19 23:34:04.000000000 +0200
+++ xmltv2vdr.pl 2004-03-09 20:08:23.591058392 +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/i ) && ( $xmlline =~ /$xmltv_channel_name/ ) && ( $xmlline !~ /clumpidx=\"1\/2\"/ ) && ( ! $chanevent ) )
{
- $chanevent = 1;
- ( $null, $xmlst, $null, $xmlet, @null ) = split(/\"/, $xmlline);
- $vdrst = &xmltime2vdr($xmlst);
- $vdret = &xmltime2vdr($xmlet);
- $vdrdur = $vdret - $vdrst;
- $vdrid = $vdrst / 60 % 0xFFFF;
-
- # Send VDR Event
- SVDRPsend("E $vdrid $vdrst $vdrdur 0");
+ if ( $xmlline =~ /start=(['"])([-+\s\d]+)\1/i )
+ {
+ $vdrst = &xmltime2vdr($2)
+ }
+ if ( $xmlline =~ /stop=(['"])([-+\s\d]+)\1/i )
+ {
+ $vdret = &xmltime2vdr($2)
+ # 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
+ {
+ $vdret = &xmltime2vdr($2) if $xmlline_next =~ /start=(['"])([-+\s\d]+)\1/i;
+ # Only if the event is not yet finished, that is, this next event
+ # has not started, we tag the info as complete
+ $chanevent = 1;
+ # 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 ( 1 )
+ # 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