diff options
Diffstat (limited to 'epg.c')
-rw-r--r-- | epg.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * - * $Id: epg.c 1.55 2006/01/29 13:00:26 kls Exp $ + * $Id: epg.c 1.56 2006/01/29 14:04:04 kls Exp $ */ #include "epg.h" @@ -16,6 +16,8 @@ #include <ctype.h> #include <time.h> +#define RUNNINGSTATUSTIMEOUT 30 // seconds before the running status is considered unknown + // --- tComponent ------------------------------------------------------------ cString tComponent::ToString(void) @@ -204,7 +206,7 @@ bool cEvent::HasTimer(void) const bool cEvent::IsRunning(bool OrAboutToStart) const { - return runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing); + return SeenWithin(RUNNINGSTATUSTIMEOUT) && runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing); } cString cEvent::GetDateString(void) const @@ -658,25 +660,22 @@ void cSchedule::UnhashEvent(cEvent *Event) eventsHashStartTime.Del(Event, Event->StartTime()); } -const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) const +const cEvent *cSchedule::GetPresentEvent(void) const { const cEvent *pe = NULL; time_t now = time(NULL); for (cEvent *p = events.First(); p; p = events.Next(p)) { - if (p->StartTime() <= now && now < p->EndTime()) { + if (p->StartTime() <= now && now < p->EndTime()) pe = p; - if (!CheckRunningStatus) - break; - } - if (CheckRunningStatus && p->SeenWithin(30) && p->RunningStatus() >= SI::RunningStatusPausing) + if (p->SeenWithin(RUNNINGSTATUSTIMEOUT) && p->RunningStatus() >= SI::RunningStatusPausing) return p; } return pe; } -const cEvent *cSchedule::GetFollowingEvent(bool CheckRunningStatus) const +const cEvent *cSchedule::GetFollowingEvent(void) const { - const cEvent *p = GetPresentEvent(CheckRunningStatus); + const cEvent *p = GetPresentEvent(); if (p) p = events.Next(p); return p; |