1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The margins for timer recordings are now always limited to the duration of the previous and next event

This commit is contained in:
Klaus Schmidinger 2021-04-04 13:38:13 +02:00
parent b80c22e9c4
commit 8f1419fff5
4 changed files with 28 additions and 14 deletions

View File

@ -9631,3 +9631,5 @@ Video Disk Recorder Revision History
causes a new event to be created, but rather modifies the existing one. This 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 avoids possible interruptions in VPS recordings in case the event's start time
is changed while the recording is already going on. 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.

3
MANUAL
View File

@ -1023,6 +1023,9 @@ timer, making "TITLE - EPISODE" and "TITLE: EPISODE" the same.
after the official end time it shall stop recording. after the official end time it shall stop recording.
These margins are added automatically to timers that These margins are added automatically to timers that
are created from the EPG data. 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 priority = 50 The default Priority and Lifetime values used when
Default lifetime = 99 creating a new timer event. A Lifetime value of 99 Default lifetime = 99 creating a new timer event. A Lifetime value of 99

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "timers.h"
@ -58,8 +58,11 @@ cTimer::cTimer(bool Instant, bool Pause, const cChannel *Channel)
tstart = Event->Vps(); tstart = Event->Vps();
} }
else { else {
tstop += Setup.MarginStop * 60; int MarginStart = 0;
tstart -= Setup.MarginStart * 60; int MarginStop = 0;
CalcMargins(MarginStart, MarginStop, Event);
tstart -= MarginStart;
tstop += MarginStop;
} }
day = SetTime(tstart, 0); day = SetTime(tstart, 0);
struct tm *time = localtime_r(&tstart, &tm_r); 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 tstart = (flags & tfVps) ? Event->Vps() : Event->StartTime();
time_t tstop = tstart + Event->Duration(); time_t tstop = tstart + Event->Duration();
if (!(HasFlags(tfVps))) { if (!(HasFlags(tfVps))) {
int MarginStart = Setup.MarginStart * 60; int MarginStart = 0;
int MarginStop = Setup.MarginStop * 60; int MarginStop = 0;
if (PatternTimer) { CalcMargins(MarginStart, MarginStop, Event);
// 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));
}
tstart -= MarginStart; tstart -= MarginStart;
tstop += MarginStop; tstop += MarginStop;
} }
@ -273,6 +269,18 @@ cTimer& cTimer::operator= (const cTimer &Timer)
return *this; 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 int cTimer::Compare(const cListObject &ListObject) const
{ {
const cTimer *ti = (const cTimer *)&ListObject; const cTimer *ti = (const cTimer *)&ListObject;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __TIMERS_H
@ -55,6 +55,7 @@ public:
cTimer(const cTimer &Timer); cTimer(const cTimer &Timer);
virtual ~cTimer(); virtual ~cTimer();
cTimer& operator= (const cTimer &Timer); cTimer& operator= (const cTimer &Timer);
void CalcMargins(int &MarginStart, int &MarginStop, const cEvent *Event);
virtual int Compare(const cListObject &ListObject) const; virtual int Compare(const cListObject &ListObject) const;
int Id(void) const { return id; } int Id(void) const { return id; }
bool Recording(void) const { return HasFlags(tfRecording); } bool Recording(void) const { return HasFlags(tfRecording); }