From af3cb1c9c3285fef9dca1eba1ee1cab0d7d76011 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 11 Mar 2018 13:19:30 +0100 Subject: [PATCH] Improved handling VPS timers to better react to EPG changes during an ongoing recording --- HISTORY | 3 ++- UPDATE-2.4.0 | 1 + timers.c | 30 +++++++++++++++++++----------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index a0a966a0..cac20fdb 100644 --- a/HISTORY +++ b/HISTORY @@ -9162,7 +9162,7 @@ Video Disk Recorder Revision History a subdirectory. - SVDRP peering can now be limited to the default SVDRP host (see MANUAL for details). -2018-03-09: Version 2.3.9 +2018-03-11: Version 2.3.9 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). @@ -9306,3 +9306,4 @@ Video Disk Recorder Revision History - Removed sending the SVDRP command UPDR to peer VDRs whenever a change is made to the recordings in the video directory (which was introduced in version 2.3.8), because it triggered re-reading the video directory too fast. +- Improved handling VPS timers to better react to EPG changes during an ongoing recording. diff --git a/UPDATE-2.4.0 b/UPDATE-2.4.0 index a695aa95..cdf56dc7 100644 --- a/UPDATE-2.4.0 +++ b/UPDATE-2.4.0 @@ -200,6 +200,7 @@ Timers: The old version of cSkinDisplayMenu::SetItemEvent() (without the TimerActive parameter) is still there for backwards compatibility. It may be removed in a future version, so plugin authors should switch to the new one. +- Improved handling VPS timers to better react to EPG changes during an ongoing recording. Plugins: 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 } } }