mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used to check whether a matching event already has a local timer
This commit is contained in:
parent
4e52547a59
commit
0003d6391c
10
HISTORY
10
HISTORY
@ -9640,3 +9640,13 @@ Video Disk Recorder Revision History
|
||||
by Jürgen Schneider).
|
||||
- No longer switching devices for pattern timers (thanks to Helmut Binder).
|
||||
- cTimer::TriggerRespawn() now only acts on local timers.
|
||||
|
||||
2021-04-10:
|
||||
|
||||
- When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used
|
||||
to check whether a matching event already has a local spawned timer. Reason: creating a timer
|
||||
from the Schedule menu (by pressing the Red button), then pressing Red again to edit
|
||||
the timer, making it a pattern timer and moving it to a remote machine, did not cause
|
||||
an immediate respawn on the remote machine, because at that time the event on the remote
|
||||
machine was still covered by the initial timer (which, from the remote machine's standpoint,
|
||||
was "remote").
|
||||
|
17
timers.c
17
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 5.9 2021/04/06 14:25:05 kls Exp $
|
||||
* $Id: timers.c 5.10 2021/04/10 10:09:50 kls Exp $
|
||||
*/
|
||||
|
||||
#include "timers.h"
|
||||
@ -731,7 +731,7 @@ bool cTimer::SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers)
|
||||
if (Matches(e) != tmNone) {
|
||||
bool CheckThis = false;
|
||||
bool CheckNext = false;
|
||||
if (e->HasTimer()) // a matching event that already has a timer
|
||||
if (Timers->GetTimerForEvent(e, tfSpawned)) // a matching event that already has a spawned timer
|
||||
CheckNext = true;
|
||||
else if (e->EndTime() > Now) { // only look at events that have not yet ended
|
||||
CheckThis = true;
|
||||
@ -744,7 +744,7 @@ bool cTimer::SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers)
|
||||
if (CheckNext) {
|
||||
// We also check the event immediately following this one:
|
||||
e = Schedule->Events()->Next(e);
|
||||
if (e && !e->HasTimer() && Matches(e) != tmNone) {
|
||||
if (e && !Timers->GetTimerForEvent(e, tfSpawned) && Matches(e) != tmNone) {
|
||||
SpawnPatternTimer(e, Timers);
|
||||
TimersSpawned = true;
|
||||
}
|
||||
@ -1084,6 +1084,17 @@ const cTimer *cTimers::GetMatch(const cEvent *Event, eTimerMatch *Match) const
|
||||
return t;
|
||||
}
|
||||
|
||||
const cTimer *cTimers::GetTimerForEvent(const cEvent *Event, eTimerFlags Flags)
|
||||
{
|
||||
if (Event && Event->HasTimer()) {
|
||||
for (const cTimer *ti = First(); ti; ti = Next(ti)) {
|
||||
if (ti->Event() == Event && ti->Local() && ti->HasFlags(Flags))
|
||||
return ti;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int cTimers::GetMaxPriority(void) const
|
||||
{
|
||||
int n = -1;
|
||||
|
3
timers.h
3
timers.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: timers.h 5.4 2021/04/06 08:48:35 kls Exp $
|
||||
* $Id: timers.h 5.5 2021/04/10 10:09:50 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TIMERS_H
|
||||
@ -192,6 +192,7 @@ public:
|
||||
cTimer *GetMatch(time_t t) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetMatch(t)); };
|
||||
const cTimer *GetMatch(const cEvent *Event, eTimerMatch *Match = NULL) const;
|
||||
cTimer *GetMatch(const cEvent *Event, eTimerMatch *Match = NULL) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetMatch(Event, Match)); }
|
||||
const cTimer *GetTimerForEvent(const cEvent *Event, eTimerFlags Flags = tfNone);
|
||||
int GetMaxPriority(void) const;
|
||||
///< Returns the maximum priority of all local timers that are currently recording.
|
||||
///< If there is no local timer currently recording, -1 is returned.
|
||||
|
Loading…
Reference in New Issue
Block a user