X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/508abbaab9864e95b0068a986e83ec9bca515ddf..b7ebc25eb39de9b564be52626b07e8ecba810d9c:/RecordTimer.py diff --git a/RecordTimer.py b/RecordTimer.py index 42428889..cdd37eb5 100644 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -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