summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2018-03-11 13:19:30 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2018-03-11 13:19:30 +0100
commitaf3cb1c9c3285fef9dca1eba1ee1cab0d7d76011 (patch)
tree1fabd56b5787b71fcdc03800bf309e650a5cb110 /timers.c
parentc6796ac6df08ae81f65fd1b4961f29f3007dce57 (diff)
downloadvdr-af3cb1c9c3285fef9dca1eba1ee1cab0d7d76011.tar.gz
vdr-af3cb1c9c3285fef9dca1eba1ee1cab0d7d76011.tar.bz2
Improved handling VPS timers to better react to EPG changes during an ongoing recording
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/timers.c b/timers.c
index bc4dbbfa..910ddb7a 100644
--- a/timers.c
+++ b/timers.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: timers.c 4.16 2018/02/28 10:05:52 kls Exp $
+ * $Id: timers.c 4.17 2018/03/11 13:03:23 kls Exp $
*/
#include "timers.h"
@@ -485,9 +485,16 @@ eTimerMatch cTimer::Matches(const cEvent *Event, int *Overlap) const
bool UseVps = HasFlags(tfVps) && Event->Vps();
Matches(UseVps ? Event->Vps() : Event->StartTime(), true);
int overlap = 0;
- if (UseVps)
- overlap = (startTime == Event->Vps()) ? FULLMATCH + (Event->IsRunning() ? 200 : 100) : 0;
- if (!overlap) {
+ if (UseVps) {
+ if (startTime == Event->Vps()) {
+ overlap = FULLMATCH;
+ if (Event->IsRunning())
+ overlap += 200;
+ else if (Event->RunningStatus() != SI::RunningStatusNotRunning)
+ overlap += 100;
+ }
+ }
+ else {
if (startTime <= Event->StartTime() && Event->EndTime() <= stopTime)
overlap = FULLMATCH;
else if (stopTime <= Event->StartTime() || Event->EndTime() <= startTime)
@@ -498,8 +505,6 @@ eTimerMatch cTimer::Matches(const cEvent *Event, int *Overlap) const
startTime = stopTime = 0;
if (Overlap)
*Overlap = overlap;
- if (UseVps)
- return overlap > FULLMATCH ? tmFull : tmNone;
return overlap >= FULLMATCH ? tmFull : overlap > 0 ? tmPartial : tmNone;
}
return tmNone;
@@ -509,7 +514,10 @@ eTimerMatch cTimer::Matches(const cEvent *Event, int *Overlap) const
bool cTimer::Expired(void) const
{
- return IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL) && (!HasFlags(tfVps) || !event || !event->Vps());
+ return IsSingleEvent()
+ && !Recording()
+ && StopTime() + EXPIRELATENCY <= time(NULL)
+ && (!HasFlags(tfVps) || !event || !event->Vps() || event->EndTime() + EXPIRELATENCY <= time(NULL));
}
time_t cTimer::StartTime(void) const
@@ -543,12 +551,12 @@ bool cTimer::SetEventFromSchedule(const cSchedules *Schedules)
if (HasFlags(tfVps) && Schedule->Events()->First()->Vps()) {
// VPS timers only match if their start time exactly matches the event's VPS time:
for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
- if (e->StartTime() && e->RunningStatus() != SI::RunningStatusNotRunning) { // skip outdated events
+ if (e->StartTime()) {
int overlap = 0;
- Matches(e, &overlap);
- if (overlap > FULLMATCH) {
+ if (Matches(e, &overlap) == tmFull) {
Event = e;
- break; // take the first matching event
+ if (overlap > FULLMATCH)
+ break; // take the first matching event
}
}
}