diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | epg.c | 13 | ||||
-rw-r--r-- | epg.h | 4 | ||||
-rw-r--r-- | menu.c | 9 | ||||
-rw-r--r-- | timers.c | 18 |
5 files changed, 29 insertions, 16 deletions
@@ -2719,3 +2719,4 @@ Video Disk Recorder Revision History - Completed the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed some descriptor handling in 'libsi' (thanks to Stéphane Esté-Gracias). - Fixed handling the current menu item (thanks to Marc Hoppe). +- Fixed assigning events to timers (they no longer get "stuck"). @@ -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.14 2004/02/29 13:48:34 kls Exp $ + * $Id: epg.c 1.15 2004/03/06 10:12:50 kls Exp $ */ #include "epg.h" @@ -105,6 +105,11 @@ bool cEvent::HasTimer(void) const return false; } +bool cEvent::IsRunning(bool OrAboutToStart) const +{ + return runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing); +} + const char *cEvent::GetDateString(void) const { static char buf[25]; @@ -475,7 +480,7 @@ const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) 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->StartTime() + p->Duration()) { + if (p->StartTime() <= now && now < p->EndTime()) { pe = p; if (!CheckRunningStatus) break; @@ -514,7 +519,7 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const time_t delta = INT_MAX; for (cEvent *p = events.First(); p; p = events.Next(p)) { time_t dt = Time - p->StartTime(); - if (dt >= 0 && dt < delta && p->StartTime() + p->Duration() >= Time) { + if (dt >= 0 && dt < delta && p->EndTime() >= Time) { delta = dt; pe = p; } @@ -555,7 +560,7 @@ void cSchedule::Cleanup(time_t Time) Event = events.Get(a); if (!Event) break; - if (!Event->HasTimer() && Event->StartTime() + Event->Duration() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety + if (!Event->HasTimer() && Event->EndTime() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety events.Del(Event); a--; } @@ -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.h 1.11 2004/02/29 14:10:06 kls Exp $ + * $Id: epg.h 1.12 2004/03/06 10:09:40 kls Exp $ */ #ifndef __EPG_H @@ -49,9 +49,11 @@ public: const char *ShortText(void) const { return shortText; } const char *Description(void) const { return description; } time_t StartTime(void) const { return startTime; } + time_t EndTime(void) const { return startTime + duration; } int Duration(void) const { return duration; } time_t Vps(void) const { return vps; } bool HasTimer(void) const; + bool IsRunning(bool OrAboutToStart = false) const; const char *GetDateString(void) const; const char *GetTimeString(void) const; const char *GetEndTimeString(void) const; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.293 2004/02/29 14:11:16 kls Exp $ + * $Id: menu.c 1.294 2004/03/06 10:13:15 kls Exp $ */ #include "menu.h" @@ -18,7 +18,6 @@ #include "cutter.h" #include "eitscan.h" #include "i18n.h" -#include "libsi/si.h" #include "menuitems.h" #include "plugin.h" #include "recording.h" @@ -1216,7 +1215,7 @@ cMenuWhatsOnItem::cMenuWhatsOnItem(const cEvent *Event, cChannel *Channel) int TimerMatch; char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' '; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; - char r = event->RunningStatus() > SI::RunningStatusNotRunning ? '*' : ' '; + char r = event->IsRunning() ? '*' : ' '; asprintf(&buffer, "%d\t%.*s\t%.*s\t%c%c%c\t%s", channel->Number(), 6, channel->Name(), 5, event->GetTimeString(), t, v, r, event->Title()); SetText(buffer, false); } @@ -1334,7 +1333,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event) int TimerMatch; char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' '; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; - char r = event->RunningStatus() > SI::RunningStatusNotRunning ? '*' : ' '; + char r = event->IsRunning() ? '*' : ' '; asprintf(&buffer, "%.*s\t%.*s\t%c%c%c\t%s", 5, event->GetDateString(), 5, event->GetTimeString(), t, v, r, event->Title()); SetText(buffer, false); } @@ -1390,7 +1389,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel) time_t now = time(NULL) - Setup.EPGLinger * 60; for (int a = 0; a < num; a++) { const cEvent *Event = Schedule->GetEventNumber(a); - if (Event->StartTime() + Event->Duration() > now || Event == PresentEvent) + if (Event->EndTime() > now || Event == PresentEvent) Add(new cMenuScheduleItem(Event), Event == PresentEvent); } } @@ -4,14 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 1.10 2004/02/29 14:20:48 kls Exp $ + * $Id: timers.c 1.11 2004/03/06 11:22:57 kls Exp $ */ #include "timers.h" #include <ctype.h> #include "channels.h" #include "i18n.h" -#include "libsi/si.h" // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' // format characters in order to allow any number of blanks after a numeric @@ -333,8 +332,8 @@ bool cTimer::Matches(time_t t, bool Directly) if (HasFlags(tfActive)) { if (HasFlags(tfVps) && !Directly && event && event->Vps()) { startTime = event->StartTime(); - stopTime = startTime + event->Duration(); - return event->RunningStatus() > SI::RunningStatusNotRunning; + stopTime = event->EndTime(); + return event->IsRunning(true); } return startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers } @@ -350,9 +349,14 @@ int cTimer::Matches(const cEvent *Event) bool m1 = Matches(t1, true); bool m2 = UseVps ? m1 : Matches(t2, true); startTime = stopTime = 0; - if (m1 && m2) + if (m1 && m2) { + if (UseVps && Event->IsRunning(true)) + return tmFull; + if (time(NULL) > Event->EndTime()) + return tmNone; return tmFull; - if (m1 || m2) + } + if ((m1 || m2) && time(NULL) <= Event->EndTime()) return tmPartial; } return tmNone; @@ -381,6 +385,8 @@ void cTimer::SetEvent(const cEvent *Event) sprintf(vpsbuf, "(VPS: %s) ", Event->GetVpsString()); isyslog("timer %d (%d %04d-%04d '%s') set to event %s %s-%s %s'%s'", Index() + 1, Channel()->Number(), start, stop, file, Event->GetDateString(), Event->GetTimeString(), Event->GetEndTimeString(), vpsbuf, Event->Title()); } + else + isyslog("timer %d (%d %04d-%04d '%s') set to no event", Index() + 1, Channel()->Number(), start, stop, file); event = Event; } } |