remove index_*.xml on uninstall
[enigma2.git] / RecordTimer.py
index 424288898dc8d5a642d6eb16c2a5002784499d63..cdd37eb598f2e7a7fdc3cb252a29e3803991f6ec 100644 (file)
@@ -217,6 +217,11 @@ class RecordTimerEntry(timer.TimerEntry, object):
                if next_state == self.StatePrepared:
                        if self.tryPrepare():
                                self.log(6, "prepare ok, waiting for begin")
+                               # create file to "reserve" the filename
+                               # because another recording at the same time on another service can try to record the same event
+                               # i.e. cable / sat.. then the second recording needs an own extension... when we create the file
+                               # here than calculateFilename is happy
+                               open(self.Filename + ".ts", "w").close() 
                                # fine. it worked, resources are allocated.
                                self.next_activation = self.begin
                                self.backoff = 0
@@ -435,7 +440,36 @@ class RecordTimer(timer.Timer):
                        self.loadTimer()
                except IOError:
                        print "unable to load timers from file!"
-                       
+
+       def doActivate(self, w):
+               # when activating a timer which has already passed,
+               # simply abort the timer. don't run trough all the stages.
+               if w.shouldSkip():
+                       w.state = TimerEntry.StateEnded
+               else:
+                       # when active returns true, this means "accepted".
+                       # otherwise, the current state is kept.
+                       # the timer entry itself will fix up the delay then.
+                       if w.activate():
+                               w.state += 1
+
+               self.timer_list.remove(w)
+
+               # did this timer reached the last state?
+               if w.state < TimerEntry.StateEnded:
+                       # no, sort it into active list
+                       insort(self.timer_list, w)
+               else:
+                       # yes. Process repeated, and re-add.
+                       if w.repeated:
+                               w.processRepeated()
+                               w.state = TimerEntry.StateWaiting
+                               self.addTimerEntry(w)
+                       else:
+                               insort(self.processed_timers, w)
+               
+               self.stateChanged(w)
+
        def isRecording(self):
                isRunning = False
                for timer in self.timer_list:
@@ -577,7 +611,6 @@ class RecordTimer(timer.Timer):
        def getNextRecordingTime(self):
                now = time.time()
                for timer in self.timer_list:
-                       print "timer", timer
                        next_act = timer.getNextActivation()
                        if timer.justplay or next_act < now:
                                continue