mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Fixed assigning events to timers (they no longer get "stuck")
This commit is contained in:
18
timers.c
18
timers.c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user