Commit Message
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
@@ -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;
}