don't translate "", add FIXME
[enigma2.git] / timer.py
index 169d329..a98481c 100644 (file)
--- a/timer.py
+++ b/timer.py
@@ -113,12 +113,13 @@ class Timer:
                for f in self.on_state_change:
                        f(entry)
                        
+       def getNextRecordingTime(self):
+               if len(self.timer_list) > 0:
+                       return self.timer_list[0].begin
+               return -1
+                       
        def cleanup(self):
-               new_processed_timers = []
-               for x in self.processed_timers:
-                       if x.disabled:
-                               new_processed_timers.append(x)
-               self.processed_timers = new_processed_timers
+               self.processed_timers = [entry for entry in self.processed_timers if entry.disabled]
        
        def addTimerEntry(self, entry, noRecalc=0):
                entry.processRepeated()
@@ -167,7 +168,10 @@ class Timer:
        
        def timeChanged(self, timer):
                timer.timeChanged()
-               self.timer_list.remove(timer)
+               if timer.state == TimerEntry.StateEnded:
+                       self.processed_timers.remove(timer)
+               else:
+                       self.timer_list.remove(timer)
 
                self.addTimerEntry(timer)
        
@@ -177,8 +181,7 @@ class Timer:
                # when activating a timer which has already passed,
                # simply abort the timer. don't run trough all the stages.
                if w.shouldSkip():
-                       w.abort()
-                       bisect.insort(self.processed_timers, w)
+                       w.state = TimerEntry.StateEnded
                else:
                        # when active returns true, this means "accepted".
                        # otherwise, the current state is kept.