def JobMessage(self): if self.callback is not None: if self.simulateOnly == True: self.callback(self.autotimers, self.skipped) else: total = (self.new + self.modified + len(self.conflicting) + len(self.existing) + len(self.similars)) _result = (total, self.new, self.modified, self.autotimers, self.conflicting, self.similars, self.existing, self.skipped) self.callback(_result) elif self.autoPoll: if self.conflicting and config.plugins.autotimer.notifconflict.value: AddPopup( _("%d conflict(s) encountered when trying to add new timers:\n%s" ) % (len(self.conflicting), '\n'.join([ _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2])) for x in self.conflicting ])), MessageBox.TYPE_INFO, 15, CONFLICTNOTIFICATIONID) elif self.similars and config.plugins.autotimer.notifsimilar.value: AddPopup( _("%d conflict(s) solved with similar timer(s):\n%s") % (len(self.similars), '\n'.join([ _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2])) for x in self.similars ])), MessageBox.TYPE_INFO, 15, SIMILARNOTIFICATIONID) else: AddPopup( _("Found a total of %d matching Events.\n%d Timer were added and\n%d modified,\n%d conflicts encountered,\n%d unchanged,\n%d similars added." ) % ((self.new + self.modified + len(self.conflicting) + len(self.existing) + len(self.similars)), self.new, self.modified, len(self.conflicting), len( self.existing), len(self.similars)), MessageBox.TYPE_INFO, 15, NOTIFICATIONID)
def loadTimer(self): try: doc = xml.etree.cElementTree.parse(self.Filename) except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "timers.xml failed to load!" try: import os os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "renaming broken timer failed" return except IOError: print "timers.xml not found!" return root = doc.getroot() checkit = False timer_text = "" for timer in root.findall("timer"): newTimer = createTimer(timer) conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True) if conflict_list: checkit = True if newTimer in conflict_list: timer_text += _("\nTimer '%s' disabled!") % newTimer.name if checkit: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
def deleteConfirmed(self, ret): if not ret: return if self.currlist == "remote": absRemoteFile, fileName, fileSize = self.getRemoteFile() if not fileName: return def callback(ret=None): AddPopup( _("Removed %s.") % (fileName), MessageBox.TYPE_INFO, -1) def errback(ret=None): AddPopup( _("Could not delete %s.") % (fileName), MessageBox.TYPE_ERROR, -1) self.ftpclient.removeFile(absRemoteFile).addCallback( callback).addErrback(errback) else: assert (self.currlist == "local") absLocalFile, fileName = self.getLocalFile() if not fileName: return try: os_unlink(absLocalFile) except OSError as oe: AddPopup( _("Could not delete %s.") % (fileName), MessageBox.TYPE_ERROR, -1) else: AddPopup( _("Removed %s.") % (fileName), MessageBox.TYPE_INFO, -1)
def simplerss_handle_callback(el): try: from Plugins.Extensions.SimpleRSS.RSSPoller import update_callbacks except ImportError as e: # Notify the user about a too old or missing SimpleRSS instalation when # enabling this feature if not el.value: return from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox try: import Plugins.Extensions.SimpleRSS.plugin AddPopup( _("Your version if SimpleRSS is too old to support this feature.\nIf possible update your SimpleRSS installation." ), MessageBox.TYPE_ERROR, 5) except ImportError as e: AddPopup( _("This feature requires SimpleRSS to be installed.\nYou can do so with the Plugin Installer, see the User Manual for further explanation." ), MessageBox.TYPE_ERROR, 5) else: if el.value: if simplerss_update_callback not in update_callbacks: update_callbacks.append(simplerss_update_callback) elif simplerss_update_callback in update_callbacks: update_callbacks.remove(simplerss_update_callback)
def gotThreadMsg(self, msg): """Create Notifications if there is anything to display.""" ret = self.__queue.pop() conflicts = ret[4] if conflicts and config.plugins.autotimer.notifconflict.value and Standby.inStandby is None: AddPopup( #_("%d conflict(s) encountered when trying to add new timers:\n%s") % (len(conflicts), '\n'.join([_("%s: %s at %s") % (x[4], x[0], asctime(localtime(x[2]))) for x in conflicts])), _("%d conflict(s) encountered when trying to add new timers:\n%s" ) % (len(conflicts), '\n'.join([ _("%s: %s at %s") % (x[4], x[0], "('%s', '%s')" % FuzzyTime(x[2])) for x in conflicts ])), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, NOTIFICATIONID) similars = ret[5] if similars and config.plugins.autotimer.notifsimilar.value and Standby.inStandby is None: AddPopup( _("%d conflict(s) solved with similar timer(s):\n%s") % (len(similars), '\n'.join([ _("%s: %s at %s") % (x[4], x[0], "('%s', '%s')" % FuzzyTime(x[2])) for x in similars ])), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, SIMILARNOTIFICATIONID) added_timer = ret[1] if added_timer and config.plugins.autotimer.notiftimers.value and Standby.inStandby is None: AddPopup( _("AutoTimer\n%d timer(s) were added.") % (ret[1]), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, TIMERNOTIFICATIONID)
def loadTimer(self): # TODO: PATH! if not Directories.fileExists(self.Filename): return try: doc = xml.etree.cElementTree.parse(self.Filename) except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "timers.xml failed to load!" try: import os os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "renaming broken timer failed" return except IOError: print "timers.xml not found!" return root = doc.getroot() # put out a message when at least one timer overlaps checkit = True for timer in root.findall("timer"): newTimer = createTimer(timer) if (self.record(newTimer, True, dosave=False) is not None) and (checkit == True): from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!"), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") checkit = False # at moment it is enough when the message is displayed one time
def renameCallback(self, newName=None): if not newName: return if self.currlist == "remote": absRemoteFile, fileName, fileSize = self.getRemoteFile() if not fileName: return directory = self["remote"].getCurrentDirectory() sep = '/' if directory != '/' else '' newRemoteFile = directory + sep + newName def callback(ret=None): AddPopup(_("Renamed %s to %s.") % (fileName, newName), MessageBox.TYPE_INFO, -1) def errback(ret=None): AddPopup(_("Could not rename %s.") % (fileName), MessageBox.TYPE_ERROR, -1) self.ftpclient.rename(absRemoteFile, newRemoteFile).addCallback(callback).addErrback(errback) else: assert (self.currlist == "local") absLocalFile, fileName = self.getLocalFile() if not fileName: return directory = self["local"].getCurrentDirectory() newLocalFile = os_path.join(directory, newName) try: os_rename(absLocalFile, newLocalFile) except OSError as ose: AddPopup(_("Could not rename %s.") % (fileName), MessageBox.TYPE_ERROR, -1) else: AddPopup(_("Renamed %s to %s.") % (fileName, newName), MessageBox.TYPE_INFO, -1)
def keySave(self): if config.SleepTimer.enabled.value: for x in self["config"].list: x[1].save() self.session.nav.SleepTimer.setSleepTime(config.SleepTimer.defaulttime.value) AddPopup(_("The sleep timer has been activated."), type = MessageBox.TYPE_INFO, timeout = 3) self.close(True) else: self.session.nav.SleepTimer.clear() AddPopup(_("The sleep timer has been disabled."), type = MessageBox.TYPE_INFO, timeout = 3) self.close(True)
def startMonitoring(self, notify=True): # Stop active zap timer self.stopTimer() # Get current service and event service = self.session.nav.getCurrentService() ref = self.session.nav.getCurrentlyPlayingServiceReference() self.monitored_service = ref # Notify us on new services # ServiceEventTracker will remove itself on close if not self.__event_tracker: self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evStart: self.serviceStarted, }) # Get event information info = service and service.info() event = info and info.getEvent(0) if not event: # Alternative to get the current event epg = eEPGCache.getInstance() event = ref and ref.valid() and epg.lookupEventTime(ref, -1) if event: # Set monitoring end time self.monitored_event = event duration = event.getDuration() - (time() - event.getBeginTime()) self.monitored_bouquet = self.servicelist.getRoot() self.monitor_timer.startLongTimer(int(duration)) self.monitor_time = None if notify: name = event and event.getEventName() AddPopup( _("WerbeZapper...\nMonitoring started\n%s") % (name), MessageBox.TYPE_INFO, 3, "WerbeZapperMonitoringStarted" ) else: duration = int(config.werbezapper.duration_not_event.value) self.monitor_time = time() + (duration * 60) self.monitored_bouquet = self.servicelist.getRoot() self.monitor_timer.startLongTimer(duration* 60) self.monitored_event = None if notify: AddPopup( _("WerbeZapper...\nMonitoring started for service is not EPG.\nDuration %d Min.") % (duration), MessageBox.TYPE_INFO, 5, "WerbeZapperMonitoringStartedUnlimited" )
def startMonitoring(self, notify=True): # Stop active zap timer self.stopTimer() # Get current service and event service = self.session.nav.getCurrentService() ref = self.session.nav.getCurrentlyPlayingServiceReference() self.monitored_service = ref # Notify us on new services # ServiceEventTracker will remove itself on close if not self.__event_tracker: self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evStart: self.serviceStarted, }) # Get event information info = service and service.info() event = info and info.getEvent(0) if not event: # Alternative to get the current event epg = eEPGCache.getInstance() event = ref and ref.valid() and epg.lookupEventTime(ref, -1) if event: # Set monitoring end time self.event = event duration = event.getDuration() - ( time() - event.getBeginTime() ) self.monitor_timer.startLongTimer( int( duration ) ) if notify: name = event and event.getEventName() AddPopup( _("WerbeZapper\nMonitoring started\n%s") % (name), MessageBox.TYPE_INFO, 3, "WerbeZapperMonitoringStarted" ) else: #TEST SF2 or something without an valid epg #IDEA detect event is finished #IDEA inputbox monitoring in minutes if notify: AddPopup( _("WerbeZapper\nMonitoring started unlimited\nHas to be deactivated manually"), MessageBox.TYPE_INFO, 10, "WerbeZapperMonitoringStartedUnlimited" )
def startTimer(self, duration=0, notify=True, zapto=None): if self.zap_timer.isActive(): self.stopTimer() if duration > 0: # Save the last selected zap time for reusing it later config.werbezapper.duration.value = duration config.werbezapper.duration.save() else: # Reuse last duration duration = int(config.werbezapper.duration.value) # Keep any service related information (zap_service might not equal move_service -> subservices) self.zap_service = self.session.nav.getCurrentlyPlayingServiceReference( ) if zapto is not None or self.monitored_service is not None: self.zap_service = self.monitored_service self.epg_bouquet = self.servicelist.getRoot() self.move_service = None if zapto else self.servicelist.getCurrentSelection( ) ref_cur = self.zap_service refstr = ref_cur.toString() zap_name = ServiceReference(eServiceReference(refstr)).getServiceName() # Start Timer self.zap_time = time() + (duration * 60) self.zap_timer.startLongTimer(int(duration * 60)) if notify: # Remind the User of what he just did AddPopup( _("Zapping back %s in %d Min") % (zap_name, duration), MessageBox.TYPE_INFO, 3, "WerbeZapperZapStarted") if config.werbezapper.icon_timer.value: self.StartIndicator()
def servicePinEntered(self, service, result=None): if result in ("zapup", "zapdown"): from Screens.InfoBar import InfoBar InfoBarInstance = InfoBar.instance if InfoBarInstance and hasattr(InfoBarInstance, "servicelist"): InfoBarInstance.servicelist.servicelist.setCurrent(service) if result == "zapdown": InfoBarInstance.servicelist.servicelist.moveDown() else: InfoBarInstance.servicelist.servicelist.moveUp() InfoBarInstance.servicelist.zap() elif result: self.setSessionPinCached() self.hideBlacklist() self.callback(ref=service) elif result == False: messageText = _("The PIN code you entered is wrong.") if self.session: self.session.open(MessageBox, messageText, MessageBox.TYPE_INFO, timeout=5) else: AddPopup(messageText, MessageBox.TYPE_ERROR, timeout=5)
def __init__(self, session, api=None): Screen.__init__(self, session) HelpableScreen.__init__(self) InfoBarNotifications.__init__(self) if api is None: if config.plugins.ecasa.last_backend.value == 'picasa': self.api = PicasaApi(cache=config.plugins.ecasa.cache.value) else: self.api = FlickrApi(config.plugins.ecasa.flickr_api_key.value, cache=config.plugins.ecasa.cache.value) try: self.api.setCredentials( config.plugins.ecasa.google_username.value, config.plugins.ecasa.google_password.value ) except Exception as e: AddPopup( _("Unable to authenticate with Google: %s.") % (e.message), MessageBox.TYPE_ERROR, 5, id=AUTHENTICATION_ERROR_ID, ) else: self.api = api self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Albums")) self["key_yellow"] = StaticText() self["key_blue"] = StaticText(_("Search")) for i in xrange(self.PICS_PER_PAGE): self['image%d' % i] = Pixmap() self['title%d' % i] = StaticText() self["highlight"] = MovingPixmap() self["waitingtext"] = Label(_("Please wait... Loading list...")) self["overviewActions"] = HelpableActionMap(self, "EcasaOverviewActions", { "up": self.up, "down": self.down, "left": self.left, "right": self.right, "nextPage": (self.nextPage, _("show next page")), "prevPage": (self.prevPage, _("show previous page")), "select": self.select, "exit":self.close, "albums":(self.albums, _("show your albums (if logged in)")), "search":(self.search, _("start a new search")), "contextMenu":(self.contextMenu, _("open context menu")), }, -1) self.offset = 0 self.__highlighted = 0 self.pictures = () # thumbnail loader self.picload = ePicLoad() self.picload.PictureData.get().append(self.gotPicture) self.currentphoto = None self.queue = deque() self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session, service='', triesEntry=None, pinList=None, popup=False, simple=True, *args, **kwargs): if not pinList: pinList = [] InputBox.__init__(self, session=session, text=' ', maxSize=True, type=Input.PIN, *args, **kwargs) self.waitTime = 15 self.triesEntry = triesEntry self.pinList = pinList self['service'] = Label(service) if service and simple: self.skinName = 'PinInputPopup' if self.getTries() == 0: if self.triesEntry.time.value + self.waitTime * 60 > time(): remaining = self.triesEntry.time.value + self.waitTime * 60 - time() remainingMinutes = int(remaining / 60) remainingSeconds = int(remaining % 60) messageText = _('You have to wait %s!') % (str(remainingMinutes) + ' ' + _('minutes') + ', ' + str(remainingSeconds) + ' ' + _('seconds')) if service and simple: AddPopup(messageText, type=MessageBox.TYPE_ERROR, timeout=3) self.closePinCancel() else: self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, messageText, MessageBox.TYPE_ERROR, timeout=3)) else: self.setTries(3) self['tries'] = Label('') self.onShown.append(self.showTries)
def parseEPGCallback(ret): searchlog_txt = "" logpath = config.plugins.autotimer.searchlog_path.value if logpath == "?likeATlog?": logpath = os_path.dirname(config.plugins.autotimer.log_file.value) path_search_log = os_path.join(logpath, "autotimer_search.log") if os_path.exists(path_search_log): searchlog_txt = open(path_search_log).read() #find last log in logfile if "\n########## " in searchlog_txt: searchlog_txt = searchlog_txt.split("\n########## ") searchlog_txt = str(searchlog_txt[-1]).split("\n")[2:] searchlog_txt = "\n".join(searchlog_txt) AddPopup( _("Found a total of %(matches)d matching Events.\n%(timer)d Timer were added and\n%(modified)d modified,\n%(conflicts)d conflicts encountered,\n%(similars)d similars added.") % \ {"matches":ret[0], "timer":ret[1], "modified":ret[2], "conflicts":len(ret[4]), "similars":len(ret[5])} + "\n\n" + str(searchlog_txt), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, 'AT_PopUp_ID_ParseEPGCallback' ) # Save xml if config.plugins.autotimer.always_write_config.value: autotimer.writeXml() handleAutoPoller()
def showFinishPopup(ret): #prepare searchlogentries to show in finishPopup searchlog_txt = "" logpath = config.plugins.autotimer.searchlog_path.value if logpath == "?likeATlog?": logpath = os_path.dirname(config.plugins.autotimer.log_file.value) path_search_log = os_path.join(logpath, "autotimer_search.log") if os_path.exists(path_search_log): searchlog_txt = open(path_search_log).read() #find last log in logfile if "\n########## " in searchlog_txt: searchlog_txt = searchlog_txt.split("\n########## ") searchlog_txt = str(searchlog_txt[-1]).split("\n")[2:] #check count and length of searchlog_entries maxlistcount = 10 maxtextlength = 55 listcount = len(searchlog_txt) searchlog_txt = searchlog_txt[:maxlistcount] for i, entry in enumerate(searchlog_txt): if len(entry) > maxtextlength: searchlog_txt[i] = entry[:maxtextlength - 3] + "..." searchlog_txt = "\n".join(searchlog_txt) if listcount > maxlistcount + 1: searchlog_txt += "\n" + "and %d searchlog-entries more ..." % ( listcount - maxlistcount) AddPopup(_("Found a total of %(matches)d matching Events.\n%(timer)d Timer were added and\n%(modified)d modified,\n%(conflicts)d conflicts encountered,\n%(similars)d similars added.") % \ {"matches":ret[0], "timer":ret[1], "modified":ret[2], "conflicts":len(ret[4]), "similars":len(ret[5])} + "\n\n" + str(searchlog_txt), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, domain = NOTIFICATIONDOMAIN, id = 'AT_PopUp_ID_ParseEPGCallback')
def startTimer(self, duration=0, notify=True, zapto=None): if duration > 0: # Save the last selected zap time for reusing it later config.werbezapper.duration.value = duration config.werbezapper.duration.save() else: # Reuse last duration duration = int(config.werbezapper.duration.value) # Keep any service related information (zap_service might not equal move_service -> subservices) self.zap_service = zapto or self.session.nav.getCurrentlyPlayingServiceReference() self.move_service = None if zapto else self.servicelist.getCurrentSelection() self.root = self.servicelist.getRoot() #import ServiceReference #print([str(ServiceReference.ServiceReference(x)) for x in self.servicelist.getCurrentServicePath()]) #print(ServiceReference.ServiceReference(self.servicelist.getRoot())) # Start Timer self.zap_time = time() + (duration * 60) self.zap_timer.startLongTimer(int(duration * 60)) if notify: # Remind the User of what he just did AddPopup( _("Zapping back in %d Minute(s)") % (duration), MessageBox.TYPE_INFO, 3, "WerbeZapperZapStarted" )
def msgAddZipClosed(ret, curfile=None): if ret and curfile: try: found_dir = '' data_dir = OMB_MAIN_DIR + '/' + OMB_DATA_DIR if os.path.exists(data_dir): upload_dir = OMB_MAIN_DIR + '/' + OMB_UPLOAD_DIR if os.path.exists(upload_dir): found_dir = upload_dir else: for p in harddiskmanager.getMountedPartitions(): if p and os.access(p.mountpoint, os.F_OK | os.R_OK) and p.mountpoint != '/': data_dir = p.mountpoint + '/' + OMB_DATA_DIR if os.path.exists(data_dir) and isMounted( p.mountpoint): upload_dir = p.mountpoint + '/' + OMB_UPLOAD_DIR if os.path.exists(upload_dir): found_dir = upload_dir break if found_dir: ret = os.system("cp %s %s" % (curfile, found_dir)) if ret == 0: txt = _("zip archive was successfully added to '%s' OMB!" ) % (found_dir) else: txt = _("Error adding zip archive!") AddPopup(txt, type=MessageBox.TYPE_INFO, timeout=10, id="InfoAddZipArchive") except: pass
def reloadTimerList(self, recordHandler): doLog("[AutoTimer] Start reload timers list after search") # checking and deleting duplicate timers disabled_at = removed_at = 0 check_timer_list = recordHandler.timer_list[:] for timer in check_timer_list: check_timer_list.remove(timer) timersanitycheck = TimerSanityCheck(check_timer_list, timer) if not timersanitycheck.check(): simulTimerList = timersanitycheck.getSimulTimerList() if simulTimerList and timer in simulTimerList and "autotimer" in timer.flags and not timer.isRunning(): timer.disabled = True recordHandler.timeChanged(timer) disabled_at += 1 conflictString += ' / '.join(["%s (%s)" % (x.name, strftime("%Y%m%d %H%M", localtime(x.begin))) for x in simulTimerList]) doLog("[AutoTimer-reload] Timer %s disabled because of conflicts with %s." % (timer.name, conflictString)) elif timersanitycheck.doubleCheck() and "autotimer" in timer.flags and not timer.isRunning(): try: recordHandler.removeEntry(timer) removed_at += 1 doLog("[AutoTimer-reload] Remove double timer %s." % (timer.name)) except: doLog("[AutoTimer-reload] Error for remove double timer %s." % (timer.name)) if config.plugins.autotimer.remove_double_and_conflicts_timers.value == "yes_notify": if Standby.inStandby is None and (disabled_at or removed_at): AddPopup(_("Reload timers list.\n%d autotimer(s) disabled because conflict.\n%d double autotimer(s) removed.\n") % (disabled_at, removed_at), MessageBox.TYPE_INFO, config.plugins.autotimer.popup_timeout.value, CONFLICTINGDOUBLEID)
def zap(self, notify=True): if self.zap_service is not None: if self.root: import ServiceReference if not self.servicelist.preEnterPath( str(ServiceReference.ServiceReference(self.root))): if self.servicelist.isBasePathEqual(self.root): self.servicelist.pathUp() self.servicelist.enterPath(self.root) else: currentRoot = self.servicelist.getRoot() if currentRoot is None or currentRoot != self.root: self.servicelist.clearPath() self.servicelist.enterPath(self.root) if self.move_service: self.servicelist.setCurrentSelection(self.move_service) self.servicelist.zap() # Play zap_service (won't rezap if service equals to move_service) self.session.nav.playService(self.zap_service) if notify: # Remind the User what happens here AddPopup(_("Zapping back"), MessageBox.TYPE_INFO, 3, "WerbeZapperZapBack") # Cleanup if end timer is not running if not self.monitor_timer.isActive(): # Reset services self.zap_service = None self.move_service = None self.root = None
def _gotPage(self, data, id=None, callback=False, errorback=None): # workaround: exceptions in gotPage-callback were ignored try: self.gotPage(data, id) if callback: self.doCallback(id) except NotImplementedError as errmsg: # Don't show this error when updating in background if id is not None: AddPopup( _("Sorry, this type of feed is unsupported:\n%s") % (str(errmsg)), MessageBox.TYPE_INFO, 5, ) else: # We don't want to stop updating just because one feed is broken self.next_feed() except Exception: import traceback, sys traceback.print_exc(file=sys.stdout) # Errorback given, call it (asumme we don't need do restart timer!) if errorback is not None: errorback() return # Assume its just a temporary failure and jump over to next feed self.next_feed()
def __init__(self, session, service = "", triesEntry = None, pinList = [], popup = False, simple=True, *args, **kwargs): InputBox.__init__(self, session = session, text = " ", maxSize = True, type = Input.PIN, *args, **kwargs) self.waitTime = 15 self.triesEntry = triesEntry self.pinList = pinList self["service"] = Label(service) if service and simple: self.skinName = "PinInputPopup" if self.getTries() == 0: if (self.triesEntry.time.value + (self.waitTime * 60)) > time(): remaining = (self.triesEntry.time.value + (self.waitTime * 60)) - time() remainingMinutes = int(remaining / 60) remainingSeconds = int(remaining % 60) messageText = _("You have to wait %s!") % (str(remainingMinutes) + " " + _("minutes") + ", " + str(remainingSeconds) + " " + _("seconds")) if service and simple: AddPopup(messageText, type = MessageBox.TYPE_ERROR, timeout = 3) self.closePinCancel() else: self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, messageText, MessageBox.TYPE_ERROR, timeout = 3)) else: self.setTries(3) self["tries"] = Label("") self.onShown.append(self.showTries)
def readXml(self): # Abort if no config found if not os_path.exists(XML_CONFIG): print("[AutoTimer] No configuration file present") return # Parse if mtime differs from whats saved mtime = os_path.getmtime(XML_CONFIG) if mtime == self.configMtime: print("[AutoTimer] No changes in configuration, won't parse") return # Save current mtime self.configMtime = mtime # Parse Config try: configuration = cet_parse(XML_CONFIG).getroot() except: try: if os_path.exists(XML_CONFIG + "_old"): os_rename(XML_CONFIG + "_old", XML_CONFIG + "_old(1)") os_rename(XML_CONFIG, XML_CONFIG + "_old") print( "[AutoTimer] autotimer.xml is corrupt rename file to /etc/enigma2/autotimer.xml_old" ) except: pass if Standby.inStandby is None: AddPopup(_( "The autotimer file (/etc/enigma2/autotimer.xml) is corrupt. A new and empty config was created. A backup of the config can be found here (/etc/enigma2/autotimer.xml_old) " ), type=MessageBox.TYPE_ERROR, timeout=0, id="AutoTimerLoadFailed") self.timers = [] self.defaultTimer = preferredAutoTimerComponent( 0, # Id "", # Name "", # Match True # Enabled ) try: self.writeXml() configuration = cet_parse(XML_CONFIG).getroot() except: print( "[AutoTimer] fatal error, the autotimer.xml cannot create") return # Empty out timers and reset Ids del self.timers[:] self.defaultTimer.clear(-1, True) parseConfig(configuration, self.timers, configuration.get("version"), 0, self.defaultTimer) self.uniqueTimerId = len(self.timers)
def bareShowResult(): global loop_data, loop_counter if loop_data and config.plugins.seriesplugin.timer_popups.value: AddPopup( "SeriesPlugin:\n" + _("SP has been finished with errors:\n") + "\n" + "\n".join(loop_data), MessageBox.TYPE_ERROR, int(config.plugins.seriesplugin.timer_popups_timeout.value), 'SP_PopUp_ID_Finished') elif not loop_data and config.plugins.seriesplugin.timer_popups_success.value: AddPopup( "SeriesPlugin:\n" + _("%d timer renamed successfully") % (loop_counter), MessageBox.TYPE_INFO, int(config.plugins.seriesplugin.timer_popups_timeout.value), 'SP_PopUp_ID_Finished') loop_data = [] loop_counter = 0
def main(session, **kwargs): if config.skin.primary_skin.value == "AX_Blue_FHD_4HDF/skin.xml": session.open(AXBlue_Config) else: AddPopup( _('Please activate AXBlue FHD Skin before run the Config Plugin'), type=MessageBox.TYPE_ERROR, timeout=10) return []
def main(session, **kwargs): if config.skin.primary_skin.value == "Steampunk/skin.xml": session.open(Steampunk_Config) else: AddPopup(_( 'Please activate Steampunk HD Skin before run the Config Plugin'), type=MessageBox.TYPE_ERROR, timeout=10) return []
def transferFinished(self, msg, type, toRefresh): AddPopup(msg, type, -1) self["eta"].text = "" self["speed"].text = "" self["progress"].invalidate() self[toRefresh].refresh() self.file.close() self.file = None
def parseEPGCallback(ret): AddPopup( _("Found a total of %d matching Events.\n%d Timer were added and\n%d modified,\n%d conflicts encountered,\n%d similars added." ) % (ret[0], ret[1], ret[2], len(ret[4]), len(ret[5])), MessageBox.TYPE_INFO, 10, 'AT_PopUp_ID_ParseEPGCallback') # Save xml autotimer.writeXml() handleAutoPoller()
def select(self): if self.status: time = int(self["input"].getText()) config.SleepTimer.defaulttime.setValue(time) config.SleepTimer.defaulttime.save() config.SleepTimer.action.save() config.SleepTimer.ask.save() self.session.nav.SleepTimer.setSleepTime(time) AddPopup(_("The sleep timer has been activated."), type=MessageBox.TYPE_INFO, timeout=3) self.close(True) else: self.session.nav.SleepTimer.clear() AddPopup(_("The sleep timer has been disabled."), type=MessageBox.TYPE_INFO, timeout=3) self.close(True)
def main(session, **kwargs): if config.skin.primary_skin.value == "Blue-Line-OE-4ATV/skin.xml": session.open(BlueLine_Config) else: AddPopup(_( 'Please activate BlueLine FHD Skin before run the Config Plugin'), type=MessageBox.TYPE_ERROR, timeout=10) return []