From c55be788f33444a59fa72d31e3cad2ac202f3a82 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 25 Mar 2006 11:39:57 +0100 Subject: [PATCH] Fixed handling repeating VPS timers (they stopped recording too early) --- HISTORY | 3 ++- timers.c | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index a7651cba..d5c1be2e 100644 --- a/HISTORY +++ b/HISTORY @@ -4415,7 +4415,7 @@ Video Disk Recorder Revision History - Fixed cSchedule::GetFollowingEvent() in case there is currently no present event running (thanks to Pekka Mauno). -2006-03-19: Version 1.3.45 +2006-03-25: Version 1.3.45 - Fixed updating the "Info" button in the "Timers" menu. - Reduced the number of events to actually check when setting events to timers. @@ -4434,3 +4434,4 @@ Video Disk Recorder Revision History deleted (reported by Hardy Flor). - Fixed deleting recordings that have been removed externally when running out of disk space (reported by Jan Lenz). +- Fixed handling repeating VPS timers (they stopped recording too early). diff --git a/timers.c b/timers.c index 7b99a41f..7cb4b013 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 1.51 2006/02/28 12:40:33 kls Exp $ + * $Id: timers.c 1.52 2006/03/25 11:39:50 kls Exp $ */ #include "timers.h" @@ -446,15 +446,20 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules) const cEvent *Event = NULL; int Overlap = 0; int Distance = INT_MIN; + bool UseVps = HasFlags(tfVps); + const cEvent *PresentEvent = UseVps ? Schedule->GetPresentEvent() : NULL; + const cEvent *FollowingEvent = UseVps ? Schedule->GetFollowingEvent() : NULL; // Set up the time frame within which to check events: Matches(0, true); - time_t TimeFrameBegin = StartTime() - (HasFlags(tfVps) ? VPSLIMITBEFORE : EPGLIMITBEFORE); - time_t TimeFrameEnd = StopTime() + (HasFlags(tfVps) ? VPSLIMITAFTER : EPGLIMITAFTER); + time_t TimeFrameBegin = StartTime() - (UseVps ? VPSLIMITBEFORE : EPGLIMITBEFORE); + time_t TimeFrameEnd = StopTime() + (UseVps ? VPSLIMITAFTER : EPGLIMITAFTER); for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) { - if (e->EndTime() < TimeFrameBegin) - continue; // skip events way before the timer starts - if (e->StartTime() > TimeFrameEnd) - break; // the rest is way after the timer ends + if (!UseVps || e != event && e != PresentEvent && e != FollowingEvent) { // always check these if this is a VPS timer + if (e->EndTime() < TimeFrameBegin) + continue; // skip events way before the timer starts + if (e->StartTime() > TimeFrameEnd) + break; // the rest is way after the timer ends + } int overlap = 0; Matches(e, &overlap); if (overlap && overlap >= Overlap) {