+ dummyentry = RecordTimerEntry(self.service_ref, self.begin, new_end, self.name, self.description, self.eit, disabled=True, justplay = self.justplay, afterEvent = self.afterEvent, dirname = self.dirname, tags = self.tags)
+ dummyentry.disabled = self.disabled
+ timersanitycheck = TimerSanityCheck(NavigationInstance.instance.RecordTimer.timer_list, dummyentry)
+ if not timersanitycheck.check():
+ simulTimerList = timersanitycheck.getSimulTimerList()
+ new_end = simulTimerList[1].begin
+ del simulTimerList
+ new_end -= 30 # 30 Sekunden Prepare-Zeit lassen
+ del dummyentry
+ if new_end <= time.time():
+ return False
+ self.end = new_end
+ return True
+
+
+ def sendStandbyNotification(self, answer):
+ if answer:
+ Notifications.AddNotification(Screens.Standby.Standby)
+
+ def sendTryQuitMainloopNotification(self, answer):
+ if answer:
+ Notifications.AddNotification(Screens.Standby.TryQuitMainloop, 1)
+
+ def getNextActivation(self):
+ if self.state == self.StateEnded:
+ return self.end
+
+ next_state = self.state + 1
+
+ return {self.StatePrepared: self.start_prepare,
+ self.StateRunning: self.begin,
+ self.StateEnded: self.end }[next_state]
+
+ def failureCB(self, answer):
+ if answer == True:
+ self.log(13, "ok, zapped away")
+ #NavigationInstance.instance.stopUserServices()
+ NavigationInstance.instance.playService(self.service_ref.ref)
+ else:
+ self.log(14, "user didn't want to zap away, record will probably fail")
+
+ def timeChanged(self):
+ old_prepare = self.start_prepare
+ self.start_prepare = self.begin - self.prepare_time
+ self.backoff = 0
+
+ if int(old_prepare) != int(self.start_prepare):
+ self.log(15, "record time changed, start prepare is now: %s" % time.ctime(self.start_prepare))
+
+ def gotRecordEvent(self, record, event):
+ # TODO: this is not working (never true), please fix. (comparing two swig wrapped ePtrs)
+ if self.__record_service.__deref__() != record.__deref__():
+ return
+ self.log(16, "record event %d" % event)
+ if event == iRecordableService.evRecordWriteError:
+ print "WRITE ERROR on recording, disk full?"
+ # show notification. the 'id' will make sure that it will be
+ # displayed only once, even if more timers are failing at the
+ # same time. (which is very likely in case of disk fullness)
+ Notifications.AddPopup(text = _("Write error while recording. Disk full?\n"), type = MessageBox.TYPE_ERROR, timeout = 0, id = "DiskFullMessage")
+ # ok, the recording has been stopped. we need to properly note
+ # that in our state, with also keeping the possibility to re-try.
+ # TODO: this has to be done.
+ elif event == iRecordableService.evStart:
+ text = _("A record has been started:\n%s") % self.name
+ if self.dirnameHadToFallback:
+ text = '\n'.join([text, _("Please note that the previously selected media could not be accessed and therefore the default directory is being used instead.")])
+
+ # maybe this should be configurable?
+ Notifications.AddPopup(text = text, type = MessageBox.TYPE_INFO, timeout = 3)
+
+ # we have record_service as property to automatically subscribe to record service events
+ def setRecordService(self, service):
+ if self.__record_service is not None:
+ print "[remove callback]"
+ NavigationInstance.instance.record_event.remove(self.gotRecordEvent)
+
+ self.__record_service = service
+
+ if self.__record_service is not None:
+ print "[add callback]"
+ NavigationInstance.instance.record_event.append(self.gotRecordEvent)
+
+ record_service = property(lambda self: self.__record_service, setRecordService)