[vdr] [PATCH] GetFollowingEvent

Pekka Mauno pekka.mauno at iki.fi
Mon Feb 20 20:20:10 CET 2006


Hi,
I contribute this small patch for method
const cEvent *cSchedule::GetFollowingEvent(void) const
in epg.c.

It fixes the behaviour of method GetFollowingEvent in situation, where
present event/program has reached the end and the next event has not
started
yet.
Vanilla method returns NULL, because method GetPresentEvent returns NULL
and so it is unable to return the next event.
Patched version tries to find next event, which has not started.
Here inline and also as attachment.
----8<---8<---
diff -Nru vdr-1.3.43/epg.c vdr-1.3.43-fixed/epg.c
--- vdr-1.3.43/epg.c    2006-02-19 14:50:26.000000000 +0200
+++ vdr-1.3.43-fixed/epg.c      2006-02-20 20:38:19.000000000 +0200 @@
-692,6 +692,16 @@
   const cEvent *p = GetPresentEvent();
   if (p)
      p = events.Next(p);
+  else  {
+    // Get next event, if it exists
+    time_t now = time(NULL);
+    for (cEvent *pe = events.First(); pe; pe = events.Next(pe)) { +     
if (pe->StartTime() >= now) {
+       p = pe;
+       break;
+      }
+    }
+  }
   return p;
 }

-----8<---8<---
Pekka
-- 
Pekka Mauno, still emailing as novice


-------------- next part --------------
A non-text attachment was scrubbed...
Name: vdr-1.3.43-GetFollowingEvent.diff
Type: text/x-patch
Size: 507 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/vdr/attachments/20060220/b2aa57de/vdr-1.3.43-GetFollowingEvent.bin


More information about the vdr mailing list