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

Added a mechanism to defer timer handling in case of problems

This commit is contained in:
Klaus Schmidinger 2011-08-06 13:20:07 +02:00
parent 15007f76cf
commit 0f8495f1d8
5 changed files with 28 additions and 3 deletions

View File

@ -2744,3 +2744,7 @@ Jerome Lacarriere <lacarriere.j@gmail.com>
Mark Hawes <MARK.HAWES@au.fujitsu.com> Mark Hawes <MARK.HAWES@au.fujitsu.com>
for reporting a bug in handling DiSEqC codes for reporting a bug in handling DiSEqC codes
Frank Niederwipper <f.niederwipper@gmail.com>
for reporting a problem in timer handling in case a recording directory can't
be created

View File

@ -6664,3 +6664,5 @@ Video Disk Recorder Revision History
- Increased MAXCAIDS to 12 (thanks to Jerome Lacarriere). - Increased MAXCAIDS to 12 (thanks to Jerome Lacarriere).
- Fixed handling DiSEqC codes (thanks to Mark Hawes for reporting the bug, and - Fixed handling DiSEqC codes (thanks to Mark Hawes for reporting the bug, and
Udo Richter for suggesting the fix). Udo Richter for suggesting the fix).
- Added a mechanism to defer timer handling in case of problems (reported by
Frank Niederwipper).

5
menu.c
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: menu.c 2.28 2011/02/27 12:37:48 kls Exp $ * $Id: menu.c 2.29 2011/08/06 13:13:34 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -38,6 +38,7 @@
#define NEWTIMERLIMIT 120 // seconds until the start time of a new timer created from the Schedule menu, #define NEWTIMERLIMIT 120 // seconds until the start time of a new timer created from the Schedule menu,
// within which it will go directly into the "Edit timer" menu to allow // within which it will go directly into the "Edit timer" menu to allow
// further parameter settings // further parameter settings
#define DEFERTIMER 60 // seconds by which a timer is deferred in case of problems
#define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS) #define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS)
#define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours #define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours
@ -4134,6 +4135,8 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause)
else else
DELETENULL(recorder); DELETENULL(recorder);
} }
else
timer->SetDeferred(DEFERTIMER);
if (!Timer) { if (!Timer) {
Timers.Del(timer); Timers.Del(timer);
Timers.SetModified(); Timers.SetModified();

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 2.4 2010/01/16 11:18:53 kls Exp $ * $Id: timers.c 2.5 2011/08/06 13:13:54 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -29,6 +29,7 @@ cTimer::cTimer(bool Instant, bool Pause, cChannel *Channel)
{ {
startTime = stopTime = 0; startTime = stopTime = 0;
lastSetEvent = 0; lastSetEvent = 0;
deferred = 0;
recording = pending = inVpsMargin = false; recording = pending = inVpsMargin = false;
flags = tfNone; flags = tfNone;
if (Instant) if (Instant)
@ -62,6 +63,7 @@ cTimer::cTimer(const cEvent *Event)
{ {
startTime = stopTime = 0; startTime = stopTime = 0;
lastSetEvent = 0; lastSetEvent = 0;
deferred = 0;
recording = pending = inVpsMargin = false; recording = pending = inVpsMargin = false;
flags = tfActive; flags = tfActive;
if (Event->Vps() && Setup.UseVps) if (Event->Vps() && Setup.UseVps)
@ -118,6 +120,7 @@ cTimer& cTimer::operator= (const cTimer &Timer)
startTime = Timer.startTime; startTime = Timer.startTime;
stopTime = Timer.stopTime; stopTime = Timer.stopTime;
lastSetEvent = 0; lastSetEvent = 0;
deferred = 0;
recording = Timer.recording; recording = Timer.recording;
pending = Timer.pending; pending = Timer.pending;
inVpsMargin = Timer.inVpsMargin; inVpsMargin = Timer.inVpsMargin;
@ -422,6 +425,10 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
day = 0; day = 0;
} }
if (t < deferred)
return false;
deferred = 0;
if (HasFlags(tfActive)) { if (HasFlags(tfActive)) {
if (HasFlags(tfVps) && event && event->Vps()) { if (HasFlags(tfVps) && event && event->Vps()) {
if (Margin || !Directly) { if (Margin || !Directly) {
@ -589,6 +596,12 @@ void cTimer::SetPriority(int Priority)
priority = Priority; priority = Priority;
} }
void cTimer::SetDeferred(int Seconds)
{
deferred = time(NULL) + Seconds;
isyslog("timer %s deferred for %d seconds", *ToDescr(), Seconds);
}
void cTimer::SetFlags(uint Flags) void cTimer::SetFlags(uint Flags)
{ {
flags |= Flags; flags |= Flags;

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 1.31 2008/02/16 14:33:23 kls Exp $ * $Id: timers.h 2.1 2011/08/06 12:59:32 kls Exp $
*/ */
#ifndef __TIMERS_H #ifndef __TIMERS_H
@ -29,6 +29,7 @@ class cTimer : public cListObject {
private: private:
mutable time_t startTime, stopTime; mutable time_t startTime, stopTime;
time_t lastSetEvent; time_t lastSetEvent;
mutable time_t deferred; ///< Matches(time_t, ...) will return false if the current time is before this value
bool recording, pending, inVpsMargin; bool recording, pending, inVpsMargin;
uint flags; uint flags;
cChannel *channel; cChannel *channel;
@ -62,6 +63,7 @@ public:
const char *File(void) const { return file; } const char *File(void) const { return file; }
time_t FirstDay(void) const { return weekdays ? day : 0; } time_t FirstDay(void) const { return weekdays ? day : 0; }
const char *Aux(void) const { return aux; } const char *Aux(void) const { return aux; }
time_t Deferred(void) const { return deferred; }
cString ToText(bool UseChannelID = false) const; cString ToText(bool UseChannelID = false) const;
cString ToDescr(void) const; cString ToDescr(void) const;
const cEvent *Event(void) const { return event; } const cEvent *Event(void) const { return event; }
@ -85,6 +87,7 @@ public:
void SetPending(bool Pending); void SetPending(bool Pending);
void SetInVpsMargin(bool InVpsMargin); void SetInVpsMargin(bool InVpsMargin);
void SetPriority(int Priority); void SetPriority(int Priority);
void SetDeferred(int Seconds);
void SetFlags(uint Flags); void SetFlags(uint Flags);
void ClrFlags(uint Flags); void ClrFlags(uint Flags);
void InvFlags(uint Flags); void InvFlags(uint Flags);