diff --git a/HISTORY b/HISTORY index 4df717c6..79cf4a2d 100644 --- a/HISTORY +++ b/HISTORY @@ -4262,3 +4262,5 @@ Video Disk Recorder Revision History - Implemented a timeout for remote controls that don't deliver "repeat" keypresses very fast (based on a suggestion by Luca Olivetti; problem with the new handling of k_Repeat keypresses in channel switching reported by Udo Richter). +- When looking for the present or following EPG event, the running status is now + always taken into account. diff --git a/epg.c b/epg.c index 409f83a7..def17ec5 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $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 #include +#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; diff --git a/epg.h b/epg.h index 443b5600..ad245243 100644 --- a/epg.h +++ b/epg.h @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.h 1.29 2006/01/14 15:45:24 kls Exp $ + * $Id: epg.h 1.30 2006/01/29 14:03:13 kls Exp $ */ #ifndef __EPG_H @@ -137,8 +137,8 @@ public: void HashEvent(cEvent *Event); void UnhashEvent(cEvent *Event); const cList *Events(void) const { return &events; } - const cEvent *GetPresentEvent(bool CheckRunningStatus = false) const; - const cEvent *GetFollowingEvent(bool CheckRunningStatus = false) const; + const cEvent *GetPresentEvent(void) const; + const cEvent *GetFollowingEvent(void) const; const cEvent *GetEvent(u_int16_t EventID, time_t StartTime = 0) const; const cEvent *GetEventAround(time_t Time) const; void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const; diff --git a/menu.c b/menu.c index 28a0998c..4aa53977 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.406 2006/01/29 11:13:51 kls Exp $ + * $Id: menu.c 1.407 2006/01/29 14:04:37 kls Exp $ */ #include "menu.h" @@ -1245,7 +1245,7 @@ void cMenuSchedule::PrepareScheduleAllThis(const cEvent *Event, const cChannel * if (schedules && Channel) { const cSchedule *Schedule = schedules->GetSchedule(Channel); if (Schedule) { - const cEvent *PresentEvent = Event ? Event : Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel()); + const cEvent *PresentEvent = Event ? Event : Schedule->GetPresentEvent(); time_t now = time(NULL) - Setup.EPGLinger * 60; for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { if (ev->EndTime() > now || ev == PresentEvent) @@ -2968,7 +2968,7 @@ static void SetTrackDescriptions(int LiveChannel) if (Schedules) { const cSchedule *Schedule = Schedules->GetSchedule(Channel); if (Schedule) { - const cEvent *Present = Schedule->GetPresentEvent(true); + const cEvent *Present = Schedule->GetPresentEvent(); if (Present) Components = Present->Components(); } @@ -3058,8 +3058,8 @@ void cDisplayChannel::DisplayInfo(void) if (Schedules) { const cSchedule *Schedule = Schedules->GetSchedule(channel); if (Schedule) { - const cEvent *Present = Schedule->GetPresentEvent(true); - const cEvent *Following = Schedule->GetFollowingEvent(true); + const cEvent *Present = Schedule->GetPresentEvent(); + const cEvent *Following = Schedule->GetFollowingEvent(); if (Present != lastPresent || Following != lastFollowing) { SetTrackDescriptions(channel->Number()); displayChannel->SetEvents(Present, Following);