summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2021-04-10 10:09:50 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2021-04-10 10:09:50 +0200
commit0003d6391cbf3c16daca4cd6a45632bb619342d6 (patch)
treefed2cb559f06eea7001feca43e207597589ea93c
parent4e52547a59c14f619b053e2731a413221d65647f (diff)
downloadvdr-0003d6391cbf3c16daca4cd6a45632bb619342d6.tar.gz
vdr-0003d6391cbf3c16daca4cd6a45632bb619342d6.tar.bz2
When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used to check whether a matching event already has a local timer
-rw-r--r--HISTORY10
-rw-r--r--timers.c17
-rw-r--r--timers.h3
3 files changed, 26 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index b20a80ef..3cda625c 100644
--- a/HISTORY
+++ b/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").
diff --git a/timers.c b/timers.c
index 1dc3c75a..bfa1f700 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 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;
diff --git a/timers.h b/timers.h
index 0c707f7b..18c8362d 100644
--- a/timers.h
+++ b/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.