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

Now explicitly triggering respawning of pattern timers

This commit is contained in:
Klaus Schmidinger 2021-01-14 10:29:05 +01:00
parent c402d57809
commit 80bdc90650
6 changed files with 28 additions and 7 deletions

View File

@ -9578,7 +9578,7 @@ Video Disk Recorder Revision History
given (reported by Manuel Reimer).
- Fixed handling $(PKG_CONFIG) in newplugin (thanks to Winfried Köhler).
2021-01-11:
2021-01-14:
- Fixed strreplace() to handle NULL strings (reported by Jürgen Schneider).
- Somewhere down the road the 'x' bit of Doxyfile.filter got lost, so the
@ -9593,3 +9593,4 @@ Video Disk Recorder Revision History
(reported by Jürgen Schneider).
- Increased the number of possible modulation systems in cDevice::GetDevice()
(reported by Ulf Grüne).
- Now explicitly triggering respawning of pattern timers.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 4.5 2020/06/10 14:00:36 kls Exp $
* $Id: channels.h 5.1 2021/01/14 10:29:05 kls Exp $
*/
#ifndef __CHANNELS_H
@ -178,6 +178,7 @@ public:
void SetNumber(int Number) { number = Number; }
bool GroupSep(void) const { return groupSep; }
const char *Parameters(void) const { return parameters; }
const cSchedule *Schedule(void) const { return schedule; }
const cLinkChannels* LinkChannels(void) const { return linkChannels; }
const cChannel *RefChannel(void) const { return refChannel; }
bool IsAtsc(void) const { return cSource::IsAtsc(source); }

3
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 5.2 2021/01/01 15:26:27 kls Exp $
* $Id: menu.c 5.3 2021/01/14 10:29:05 kls Exp $
*/
#include "menu.h"
@ -1191,6 +1191,7 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
data.SetEvent(NULL);
*timer = data;
}
timer->TriggerRespawn();
LOCK_SCHEDULES_READ;
timer->SetEventFromSchedule(Schedules);
timer->Matches();

View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
* $Id: svdrp.c 5.2 2021/01/01 21:23:00 kls Exp $
* $Id: svdrp.c 5.3 2021/01/14 10:29:05 kls Exp $
*/
#include "svdrp.h"
@ -1484,6 +1484,7 @@ void cSVDRPServer::CmdDELT(const char *Option)
Timer->Skip();
cRecordControls::Process(Timers, time(NULL));
}
Timer->TriggerRespawn();
Timers->Del(Timer);
Timers->SetModified();
isyslog("SVDRP %s < %s deleted timer %s", Setup.SVDRPHostName, *clientName, *Timer->ToDescr());
@ -2063,6 +2064,7 @@ void cSVDRPServer::CmdMODT(const char *Option)
isyslog("SVDRP %s < %s modified timer %s (%s)", Setup.SVDRPHostName, *clientName, *Timer->ToDescr(), Timer->HasFlags(tfActive) ? "active" : "inactive");
if (Timer->IsPatternTimer())
Timer->SetEvent(NULL);
Timer->TriggerRespawn();
Reply(250, "%d %s", Timer->Id(), *Timer->ToText(true));
}
else

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 5.2 2021/01/07 16:00:17 kls Exp $
* $Id: timers.c 5.3 2021/01/14 10:29:05 kls Exp $
*/
#include "timers.h"
@ -739,6 +739,20 @@ bool cTimer::SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers)
return TimersSpawned;
}
void cTimer::TriggerRespawn(void)
{
if (HasFlags(tfSpawned) || IsPatternTimer()) {
if (Channel()) {
LOCK_CHANNELS_READ;
if (const cSchedule *Schedule = Channel()->Schedule()) {
dsyslog("triggering respawn for timer %s", *ToDescr());
LOCK_SCHEDULES_WRITE;
const_cast<cSchedule *>(Schedule)->SetModified();
}
}
}
}
bool cTimer::SetEventFromSchedule(const cSchedules *Schedules)
{
if (IsPatternTimer())
@ -918,7 +932,7 @@ void cTimer::OnOff(void)
SetFlags(tfActive);
SetEvent(NULL);
if (HasFlags(tfActive))
scheduleState = -1; // have pattern timers spawn if necessary
TriggerRespawn(); // have pattern timers spawn if necessary
Matches(); // refresh start and end time
}
@ -1112,6 +1126,7 @@ bool cTimers::DeleteExpired(void)
cTimer *next = Next(ti);
if (!ti->Remote() && ti->Expired()) {
ti->SetEvent(NULL); // Del() doesn't call ~cTimer() right away, so this is necessary here
ti->TriggerRespawn(); // in case this is a spawned timer
isyslog("deleting timer %s", *ti->ToDescr());
Del(ti);
TimersModified = true;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 5.1 2020/12/26 15:49:01 kls Exp $
* $Id: timers.h 5.2 2021/01/14 10:29:05 kls Exp $
*/
#ifndef __TIMERS_H
@ -98,6 +98,7 @@ public:
void SetId(int Id);
void SpawnPatternTimer(const cEvent *Event, cTimers *Timers);
bool SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers);
void TriggerRespawn(void);
bool SetEventFromSchedule(const cSchedules *Schedules);
bool SetEvent(const cEvent *Event);
void SetRecording(bool Recording);