RecordTimer.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:enigma2 作者: Openeight 项目源码 文件源码
def openChoiceActionBeforeZap(self):
        if self.ts_dialog is None:
            type = _("record")
            if self.justplay:
                type = _("zap")
            elif self.always_zap:
                type = _("zap and record")
            message = _("You must switch to the service %s (%s - '%s')!\n") % (type, self.service_ref.getServiceName(), self.name)
            if self.repeated:
                message += _("Attention, this is repeated timer!\n")
            message += _("Timeshift is running. Select an action.\n")
            choice = [(_("Zap"), "zap"), (_("Don't zap and disable timer"), "disable"), (_("Don't zap and remove timer"), "remove")]
            if not self.InfoBarInstance.save_timeshift_file:
                choice.insert(1, (_("Save timeshift in movie dir and zap"), "save_movie"))
                if self.InfoBarInstance.timeshiftActivated():
                    choice.insert(0, (_("Save timeshift and zap"), "save"))
                else:
                    choice.insert(1, (_("Save timeshift and zap"), "save"))
            else:
                message += _("Reminder, you have chosen to save timeshift file.")
            #if self.justplay or self.always_zap:
            #   choice.insert(2, (_("Don't zap"), "continue"))
            choice.insert(2, (_("Don't zap"), "continue"))
            def zapAction(choice):
                start_zap = True
                if choice:
                    if choice in ("zap", "save", "save_movie"):
                        self.log(8, "zap to recording service")
                        if choice in ("save", "save_movie"):
                            ts = self.InfoBarInstance.getTimeshift()
                            if ts and ts.isTimeshiftEnabled():
                                if choice =="save_movie":
                                    self.InfoBarInstance.save_timeshift_in_movie_dir = True
                                self.InfoBarInstance.save_timeshift_file = True
                                ts.saveTimeshiftFile()
                                del ts
                                self.InfoBarInstance.saveTimeshiftFiles()
                    elif choice == "disable":
                        self.disable()
                        NavigationInstance.instance.RecordTimer.timeChanged(self)
                        start_zap = False
                        self.log(8, "zap canceled by the user, timer disabled")
                    elif choice == "remove":
                        start_zap = False
                        self.afterEvent = AFTEREVENT.NONE
                        NavigationInstance.instance.RecordTimer.removeEntry(self)
                        self.log(8, "zap canceled by the user, timer removed")
                    elif choice == "continue":
                        if self.justplay:
                            self.end = self.begin
                        start_zap = False
                        self.log(8, "zap canceled by the user")
                if start_zap:
                    if not self.justplay:
                        self.setRecordingPreferredTuner()
                        self.failureCB(True)
                    else:
                        self.log(8, "zapping")
                        NavigationInstance.instance.playService(self.service_ref.ref)
            self.ts_dialog = self.InfoBarInstance.session.openWithCallback(zapAction, MessageBox, message, simple=True, list=choice, timeout=20)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号