diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2021-04-04 13:38:13 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2021-04-04 13:38:13 +0200 |
commit | 8f1419fff59acea5c57e861819111cfc38dd193d (patch) | |
tree | 99eeb5509c2a162c4b943fd863ec4201b971d52b | |
parent | b80c22e9c4097220cf4a1e2cce82daeca1ba4a36 (diff) | |
download | vdr-8f1419fff59acea5c57e861819111cfc38dd193d.tar.gz vdr-8f1419fff59acea5c57e861819111cfc38dd193d.tar.bz2 |
The margins for timer recordings are now always limited to the duration of the previous and next event
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | MANUAL | 3 | ||||
-rw-r--r-- | timers.c | 34 | ||||
-rw-r--r-- | timers.h | 3 |
4 files changed, 28 insertions, 14 deletions
@@ -9631,3 +9631,5 @@ Video Disk Recorder Revision History causes a new event to be created, but rather modifies the existing one. This avoids possible interruptions in VPS recordings in case the event's start time is changed while the recording is already going on. +- The margins for timer recordings are now always limited to the duration of the + previous and next event. @@ -1023,6 +1023,9 @@ timer, making "TITLE - EPISODE" and "TITLE: EPISODE" the same. after the official end time it shall stop recording. These margins are added automatically to timers that are created from the EPG data. + Note that the actual margins used may be smaller than the + given values, if the event before and/or after the event + to be recorded is shorter than the respective margin. Default priority = 50 The default Priority and Lifetime values used when Default lifetime = 99 creating a new timer event. A Lifetime value of 99 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 5.5 2021/01/19 13:21:51 kls Exp $ + * $Id: timers.c 5.6 2021/04/04 13:38:13 kls Exp $ */ #include "timers.h" @@ -58,8 +58,11 @@ cTimer::cTimer(bool Instant, bool Pause, const cChannel *Channel) tstart = Event->Vps(); } else { - tstop += Setup.MarginStop * 60; - tstart -= Setup.MarginStart * 60; + int MarginStart = 0; + int MarginStop = 0; + CalcMargins(MarginStart, MarginStop, Event); + tstart -= MarginStart; + tstop += MarginStop; } day = SetTime(tstart, 0); struct tm *time = localtime_r(&tstart, &tm_r); @@ -191,16 +194,9 @@ cTimer::cTimer(const cEvent *Event, const char *FileName, const cTimer *PatternT time_t tstart = (flags & tfVps) ? Event->Vps() : Event->StartTime(); time_t tstop = tstart + Event->Duration(); if (!(HasFlags(tfVps))) { - int MarginStart = Setup.MarginStart * 60; - int MarginStop = Setup.MarginStop * 60; - if (PatternTimer) { - // To make sure a spawned timer gets assigned to the correct event, we must - // make sure that this is the only event that overlaps 100%: - if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Prev())) - MarginStart = max(0, min(MarginStart, e->Duration() - 60)); - if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Next())) - MarginStop = max(0, min(MarginStop, e->Duration() - 60)); - } + int MarginStart = 0; + int MarginStop = 0; + CalcMargins(MarginStart, MarginStop, Event); tstart -= MarginStart; tstop += MarginStop; } @@ -273,6 +269,18 @@ cTimer& cTimer::operator= (const cTimer &Timer) return *this; } +void cTimer::CalcMargins(int &MarginStart, int &MarginStop, const cEvent *Event) +{ + MarginStart = Setup.MarginStart * 60; + MarginStop = Setup.MarginStop * 60; + // To make sure the timer gets assigned to the correct event, we must + // make sure that this is the only event that overlaps 100%: + if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Prev())) + MarginStart = max(0, min(MarginStart, e->Duration() - 60)); + if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Next())) + MarginStop = max(0, min(MarginStop, e->Duration() - 60)); +} + int cTimer::Compare(const cListObject &ListObject) const { const cTimer *ti = (const cTimer *)&ListObject; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 5.2 2021/01/14 10:29:05 kls Exp $ + * $Id: timers.h 5.3 2021/04/04 13:38:13 kls Exp $ */ #ifndef __TIMERS_H @@ -55,6 +55,7 @@ public: cTimer(const cTimer &Timer); virtual ~cTimer(); cTimer& operator= (const cTimer &Timer); + void CalcMargins(int &MarginStart, int &MarginStop, const cEvent *Event); virtual int Compare(const cListObject &ListObject) const; int Id(void) const { return id; } bool Recording(void) const { return HasFlags(tfRecording); } |