Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: VDR 1.2.1 doesn't shutdown while recording



Klaus Schmidinger <Klaus.Schmidinger@cadsoft.de> wrote:

> Well, since I don't use this feature myself we might as well change it.
> Please send me the patch (and don't forget to change the relevant docs,
> too, if necessary) and I'll apply it. In case others complain afterwards,
> at least they can't blame _me_ ;-)

O.k., find my patch below, I'm willing to bear the blame :-)

Wolfgang

-------------
diff -rubB vdr-1.2.1.orig/INSTALL vdr-1.2.1/INSTALL
--- vdr-1.2.1.orig/INSTALL	Sat May 31 18:20:59 2003
+++ vdr-1.2.1/INSTALL	Sat Jun 14 08:42:08 2003
@@ -163,10 +163,8 @@
 not to actually perform the system shutdown.
 
 If a timer is currently recording, the parameters will reflect the start
-time of that timer. This means that the first parameter will be a time in
-the past, and the second parameter will be a negative number. This only
-happens if the user presses the "Power" key while a timer is currently
-recording.
+time of the next active timer in future. 
 
 Before the shutdown program is called, the user will be prompted to inform
 him that the system is about to shut down. If any remote control key is
diff -rubB vdr-1.2.1.orig/timers.c vdr-1.2.1/timers.c
--- vdr-1.2.1.orig/timers.c	Sun May 11 15:48:49 2003
+++ vdr-1.2.1/timers.c	Sat Jun 14 10:00:42 2003
@@ -394,11 +394,12 @@
   return t0;
 }
 
-cTimer *cTimers::GetNextActiveTimer(void)
+cTimer *cTimers::GetNextActiveTimer(bool InFuture)
 {
   cTimer *t0 = NULL;
+  time_t Now = time(NULL);
   for (cTimer *ti = First(); ti; ti = Next(ti)) {
-      if (ti->Active() && (!t0 || *ti < *t0))
+      if (ti->Active() && (!t0 || *ti < *t0) && (!InFuture || ti->StartTime() > Now))
          t0 = ti;
       }
   return t0;
diff -rubB vdr-1.2.1.orig/timers.h vdr-1.2.1/timers.h
--- vdr-1.2.1.orig/timers.h	Sun May 11 15:35:53 2003
+++ vdr-1.2.1/timers.h	Sat Jun 14 08:42:08 2003
@@ -85,7 +85,7 @@
 public:
   cTimer *GetTimer(cTimer *Timer);
   cTimer *GetMatch(time_t t);
-  cTimer *GetNextActiveTimer(void);
+  cTimer *GetNextActiveTimer(bool InFuture=false);
   int BeingEdited(void) { return beingEdited; }
   void IncBeingEdited(void) { beingEdited++; }
   void DecBeingEdited(void) { beingEdited--; }
diff -rubB vdr-1.2.1.orig/vdr.c vdr-1.2.1/vdr.c
--- vdr-1.2.1.orig/vdr.c	Thu May 29 14:27:26 2003
+++ vdr-1.2.1/vdr.c	Sat Jun 14 10:01:56 2003
@@ -745,6 +745,9 @@
                     }
                  if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
                     ForceShutdown = false;
+	            cTimer *timer = Timers.GetNextActiveTimer(true);
+		    Next  = timer ? timer->StartTime() : 0;
+		    Delta = timer ? Next - Now : 0;
                     if (timer)
                        dsyslog("next timer event at %s", ctime(&Next));
                     if (WatchdogTimeout > 0)




-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index