def __forceRestoreCB(self, backupinfo): try: if backupinfo is None: return else: showError = False backupfile = backupinfo [1].rstrip() if FORCERESTOREGENERALERROR == backupfile: showError = True elif FORCERESTORECANCEL != backupfile and FORCERESTORENOFILES != backupfile: self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["FORCERESTORE"], backupfile) restoredFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_RESTORE"]) if restoredFile != "": eEPGCache.getInstance().Lock() eEPGCache.getInstance().load() eEPGCache.getInstance().Unlock() self.session.open(MessageBox, \ _("Backup-file \"%s\" successfully loaded!") % (restoredFile), \ type = MessageBox.TYPE_INFO) else: showError = True if showError: errorTxt = self.__getErrortext() Notifications.AddNotificationWithCallback(self.showLogFileCB, MessageBox, \ text = _("Couldn't load backup-file.\nReason: %s.\nPress OK to see the logfile!") \ % (errorTxt), type = MessageBox.TYPE_ERROR, \ timeout = 30, domain = EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("__forceRestoreCB-Error:\n" + str(format_exc()), forced=True)
def _getBackupFiles(self, sortMode): try: backupList = [] backupfiles = None backupStrList = self.executeShScript( EPGBACKUP_SHELL_CONSTANTS["EPGINFO"], sortMode) if backupStrList: backupfiles = backupStrList.split("\n") if backupfiles: for backupfile in backupfiles: if backupfile: backupfile = backupfile.replace( EPGBACKUP_SHELL_CONSTANTS["STRINGBIGGEST"], _("FILELIST_BIGGEST")) backupfile = backupfile.replace( EPGBACKUP_SHELL_CONSTANTS["STRINGYOUNGEST"], _("FILELIST_YOUNGEST")) backupfile = backupfile.replace( EPGBACKUP_SHELL_CONSTANTS["STRINGFORCED"], _("FILELIST_FORCED")) backupList.append( (backupfile, backupfile.split(" ")[0])) except: backupList.append((FORCERESTOREGENERALERROR, _("General Error!"))) debugOut("getBackupFiles-Error:\n" + str(format_exc()), forced=True) return backupList
def makeBackup(self, interactive=False): try: debugOut("making a backup!") eEPGCache.getInstance().Lock() eEPGCache.getInstance().save() eEPGCache.getInstance().Unlock() self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["MAKEBACKUP"]) self.startStopBackupTimer() if interactive or config.plugins.epgbackup.show_messages_background.value: backupedFile = self.executeShScript( EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"]) if backupedFile != "": Notifications.AddPopup( _("Backup \"%s\" successfully created!") % (backupedFile), MessageBox.TYPE_INFO, 10, domain=EPGBACKUP_NOTIFICATIONDOMAIN) else: errorTxt = self.__getErrortext() Notifications.AddNotificationWithCallback( self.showLogFileCB, MessageBox, text= _("Couldn't create a backup.\nReason: %s.\nPress OK to see the logfile!" ) % (errorTxt), type=MessageBox.TYPE_ERROR, timeout=30, domain=EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("makeBackup-Error:\n" + str(format_exc()), forced=True)
def __init__(self, session): # Initialize self.session = session self.backuptimer = eTimer() self.backuptimer.callback.append(self.makeBackup) # while postinst doesn't work in git-make self.autoinstall(config.plugins.epgbackup.backup_enabled) config.plugins.epgbackup.backup_enabled.addNotifier( self.autoinstall, initial_call=False, immediate_feedback=True) config.plugins.epgbackup.backupSaveInterval.addNotifier( self.startStopBackupTimer, initial_call=False, immediate_feedback=True) try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh self.epgrefresh_instance = epgrefresh config.plugins.epgbackup.callAfterEPGRefresh.addNotifier( self.enableBackupAfterEPGRefresh, initial_call=True, immediate_feedback=True) except: debugOut("EPGRefresh not installed!", forced=True) debugOut("Debug: EPGRefresh-Import-Error:\n" + str(format_exc())) self.notifyBootCount()
def _getConfig(self): # Name, configElement, HelpTxt, reloadConfig try: self.list = [] self.list.append(getConfigListEntry(_("Enable Backup"), config.plugins.epgbackup.backup_enabled, _("Should the Backup-Functionality be enabled?\nFor more Information have a look at the Help-Screen."), True)) if config.plugins.epgbackup.backup_enabled.value: self.list.append(getConfigListEntry(_("make Backup on start"), config.plugins.epgbackup.make_backup_after_unsuccess_restore, _("Make a backup before starting enigma. A backup-file will only be created, if no valid backup-file could be restored.\nNote: It's logically the same as making a backup at the ending of enigma, because the file didn't change in the meanwhile."), False)) if epgbackup and epgbackup.epgrefresh_instance: self.list.append(getConfigListEntry(_("make Backup after EPGRefresh"), config.plugins.epgbackup.callAfterEPGRefresh, _("Make a backup after EPGRefresh."), False)) self.list.append(getConfigListEntry(_("make Backup every"), config.plugins.epgbackup.backupSaveInterval, _("Make backups periodically?"), False)) self.list.append(getConfigListEntry(_("Restore-Strategy"), config.plugins.epgbackup.backup_strategy, None, False)) self.list.append(getConfigListEntry(_("Valid Filesize"), config.plugins.epgbackup.filesize_valid, _("EPG-Files with a less size of this value (MiB) won't be backuped."), False)) self.list.append(getConfigListEntry(_("Valid Age"), config.plugins.epgbackup.timespan_valid, _("Only keep EPG-Backup-Files younger than this days."), False)) self.list.append(getConfigListEntry(_("Show Advanced Options"), NoSave(config.plugins.epgbackup.showadvancedoptions), _("Display more Options"), True)) if config.plugins.epgbackup.showadvancedoptions.value: self.list.append(getConfigListEntry(_("EPG-File-Write Wait"), config.plugins.epgbackup.epgwrite_wait, _("How many seconds should EPGBackup be wait to check if the EPG-File-Size didn't change before it starts the Backup."), False)) self.list.append(getConfigListEntry(_("Maximum Boot-Count"), config.plugins.epgbackup.max_boot_count, _("After that times of unsuccesfully boot enigma2, the EPG-File will be deleted."), False)) self.list.append(getConfigListEntry(_("Enable Debug"), config.plugins.epgbackup.enable_debug, _("Should debugmessages be printed?\nMessages from the shell-script will be append to a file. The filename will be added with the current date"), True)) if config.plugins.epgbackup.enable_debug.value: self.list.append(getConfigListEntry(_("append plugin-messages"), config.plugins.epgbackup.plugin_debug_in_file, _("Should the debug-messages from the enigma-plugin also be append to the logfile? If you choose no the messages will print only to standard-out."), False)) self.list.append(getConfigListEntry(_("Log-directory"), config.plugins.epgbackup.backup_log_dir, _("Directory for the Logfiles."), False)) if gUserScriptExists: self.list.append(getConfigListEntry(_("Show in User-Scripts"), config.plugins.epgbackup.showin_usr_scripts, _("Should the Manage-Script be shown in User-Scripts?"), False)) self.list.append(getConfigListEntry(_("Show messages in background"), config.plugins.epgbackup.show_messages_background, _("Pop a notification if called in background?"), False)) self.list.append(getConfigListEntry(_("Show setup in"), config.plugins.epgbackup.show_setup_in, _("Where should this setup be displayed?"), False)) self.list.append(getConfigListEntry(_("Show \"Make Backup\" in extension menu"), config.plugins.epgbackup.show_make_backup_in_extmenu, _("Enable this to be able to make a Backup-File from within the extension menu."), False)) self.list.append(getConfigListEntry(_("Show \"Restore Backup\" in extension menu"), config.plugins.epgbackup.show_backuprestore_in_extmenu, _("Enable this to be able to start a restore of a Backup-File from within the extension menu."), False)) self["config"].list = self.list self["config"].setList(self.list) except: debugOut("_getConfig-Error:\n" + str(format_exc()), forced=True)
def removeNotifiers(self): try: config.plugins.epgbackup.backup_strategy.removeNotifier( self.updateVariableHelpText) except: debugOut("removeNotifiers-Error:\n" + str(format_exc()), forced=True)
def notifyBootCount(self): try: if os.path.exists(BOOTCOUNTERFILE): bootCount = "" fo = open(BOOTCOUNTERFILE) line = fo.readline() while (line): bootCount = line line = fo.readline() fo.close # We have succesfully booted, so delete the counter-File os.remove(BOOTCOUNTERFILE) bootCount = int(bootCount) if bootCount > int( config.plugins.epgbackup.max_boot_count.value): backupedFile = self.executeShScript( EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"]) Notifications.AddNotificationWithCallback( self.askDeleteBadBackupCB, MessageBox, text= _("The EPG-Backup was not performed, because there were %d unsuccessfully boot-attempts!\nThe last restored backup-file was \"%s\".\nDo you want to delete the file?" ) % (bootCount, backupedFile), type=MessageBox.TYPE_YESNO, timeout=10, domain=EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("checkBootCount-Error:\n" + str(format_exc()), forced=True)
def autoinstall(self, configentry): try: if configentry.value: self.install() else: self.uninstall() except: debugOut("autoinstall-Error:\n" + str(format_exc()), forced=True)
def updateVariableHelpText(self, configelement): try: if configelement == config.plugins.epgbackup.backup_strategy: self["help"].text = configelement.getChoices()[ configelement.getIndex()][2] except: debugOut("updateVariableHelpText-Error:\n" + str(format_exc()), forced=True)
def askDeleteBadBackupCB(self, deleteIt): try: if deleteIt: backupedFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"], getoutput = True) if backupedFile != "": debugOut("Deleting file \"%s\"..." % (backupedFile)) os.system("rm -f %s" % (backupedFile)) except: debugOut("askDeleteBadBackupCB-Error:\n" + str(format_exc()), forced=True)
def _executeSh(self, sh_cmd, param1 = "", param2 = "", getoutput = False): outtext = "" try: outtext = subprocess.check_output("%s %s %s" % (sh_cmd, param1, param2), stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as cpe: debugOut("sh-Execute-Error:\n%s: %s" %(str(cpe.returncode), cpe.output)) return outtext
def _executeSh(self, sh_cmd, param1 = "", param2 = ""): outtext = "" try: outtext = subprocess.check_output("%s %s %s" % (sh_cmd, param1, param2), stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as cpe: debugOut("sh-Execute-Error:\n%s: %s" %(str(cpe.returncode), cpe.output)) return outtext
def askDeleteBadBackupCB(self, deleteIt): try: if deleteIt: backupedFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"]) if backupedFile != "": debugOut("Deleting file \"%s\"..." % (backupedFile)) Console().ePopen("rm -f %s" % backupedFile) except: debugOut("askDeleteBadBackupCB-Error:\n" + str(format_exc()), forced=True)
def enableBackupAfterEPGRefresh(self, configentry): try: if self.epgrefresh_instance: debugOut("addEPGRefresh-Notifier: " + str(configentry.value)) if configentry.value: self.epgrefresh_instance.addFinishNotifier(self.makeBackup) else: self.epgrefresh_instance.removeFinishNotifier(self.makeBackup) except: debugOut("enableBackupAfterEPGRefresh-Error, maybe wrong Versoin of epgrefresh?:\n" + str(format_exc()), forced=True)
def AdjustPlugin(enable, PlugDescriptor): try: if enable: plugins.addPlugin(PlugDescriptor) else: plugins.removePlugin(PlugDescriptor) except ValueError: pass except: debugOut("AdjustPlugin-Error:\n" + str(format_exc()), forced=True)
def showLogFileCB(self, showIt): try: if showIt: logFile = _getLogFilename() if logFile != "": if os.path.exists(logFile): logTxt = self._executeSh("/bin/cat", logFile, getoutput = True) self.session.open(TextBox, text = _("Logfile %s:\n%s") % (logFile, logTxt)) else: self.session.open(MessageBox, \ _("There is no logfile named \"%s\"!") % (logFile), \ type = MessageBox.TYPE_ERROR) except: debugOut("showLogFileCB-Error:\n" + str(format_exc()), forced=True)
def showLogFileCB(self, showIt): try: if showIt: logFile = _getLogFilename() if logFile != "": if os.path.exists(logFile): logTxt = self.executeShScript(sh_cmd = "/bin/cat", param1 = logFile) self.session.open(TextBox, text = _("Logfile %s:\n%s") % (logFile, logTxt)) else: self.session.open(MessageBox, \ _("There is no logfile named \"%s\"!") % (logFile), \ type = MessageBox.TYPE_ERROR) except: debugOut("showLogFileCB-Error:\n" + str(format_exc()), forced=True)
def _getBackupFiles(self, sortMode): try: backupList = [] backupStrList = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["EPGINFO"], sortMode, True) if backupStrList: backupfiles = backupStrList.split("\n") if backupfiles: for backupfile in backupfiles: if backupfile: backupfile = backupfile.replace(EPGBACKUP_SHELL_CONSTANTS["STRINGBIGGEST"], _("FILELIST_BIGGEST")) backupfile = backupfile.replace(EPGBACKUP_SHELL_CONSTANTS["STRINGYOUNGEST"], _("FILELIST_YOUNGEST")) backupfile = backupfile.replace(EPGBACKUP_SHELL_CONSTANTS["STRINGFORCED"], _("FILELIST_FORCED")) backupList.append(( backupfile, backupfile.split(" ")[0] )) except: debugOut("getBackupFiles-Error:\n" + str(format_exc()), forced=True) return backupList
def autostart(reason, **kwargs): global epgbackup global gUserScriptExists if reason == 0 and "session" in kwargs: session = kwargs["session"] from EPGBackupSupport import EPGBackupSupport try: epgbackup = EPGBackupSupport(session) except: debugOut("Error while initializing EPGBackupSupport:\n" + str(format_exc()), forced=True) try: from Plugins.Extensions.UserScripts.plugin import UserScriptsConfiguration gUserScriptExists = True del UserScriptsConfiguration except: pass
def menuCallback(self, menuinfo): try: menuinfo = menuinfo and menuinfo[1] if menuinfo: if menuinfo == "MENU_RETURN_RESTORE_DATE": if epgbackup: epgbackup.forceRestore() elif menuinfo == "MENU_RETURN_RESTORE_SIZE": if epgbackup: epgbackup.forceRestoreBySize() elif menuinfo == "MENU_RETURN_DO_BACKUP": if epgbackup: epgbackup.makeBackup(interactive=True) elif menuinfo == "MENU_RETURN_SET_NEXT_BOOT_RESTORE": if epgbackup: epgbackup.setNextBootRestore() elif menuinfo == "MENU_RETURN_MAINHELP": self.showMainHelp() except: debugOut("menuCallback-Error:\n" + str(format_exc()), forced=True)
def menuCallback(self, menuinfo): try: menuinfo = menuinfo and menuinfo[1] if menuinfo: if menuinfo == "MENU_RETURN_RESTORE_DATE": if epgbackup: epgbackup.forceRestore() elif menuinfo == "MENU_RETURN_RESTORE_SIZE": if epgbackup: epgbackup.forceRestoreBySize() elif menuinfo == "MENU_RETURN_DO_BACKUP": if epgbackup: epgbackup.makeBackup(interactive = True) elif menuinfo == "MENU_RETURN_SET_NEXT_BOOT_RESTORE": if epgbackup: epgbackup.setNextBootRestore() elif menuinfo == "MENU_RETURN_MAINHELP": self.showMainHelp() except: debugOut("menuCallback-Error:\n" + str(format_exc()), forced=True)
def __init__(self, session): # Initialize self.session = session self.backuptimer = eTimer() self.backuptimer.callback.append(self.makeBackup) # while postinst doesn't work in git-make self.autoinstall(config.plugins.epgbackup.backup_enabled) config.plugins.epgbackup.backup_enabled.addNotifier(self.autoinstall, initial_call = False, immediate_feedback = True) config.plugins.epgbackup.backupSaveInterval.addNotifier(self.startStopBackupTimer, initial_call = False, immediate_feedback = True) try: from Plugins.Extensions.EPGRefresh.EPGRefresh import epgrefresh self.epgrefresh_instance = epgrefresh config.plugins.epgbackup.callAfterEPGRefresh.addNotifier(self.enableBackupAfterEPGRefresh, initial_call = True, immediate_feedback = True) except: debugOut("EPGRefresh not installed!", forced=True) debugOut("Debug: EPGRefresh-Import-Error:\n" + str(format_exc())) self.notifyBootCount()
def makeBackup(self, interactive = False): try: debugOut("making a backup!") eEPGCache.getInstance().Lock() eEPGCache.getInstance().save() eEPGCache.getInstance().Unlock() self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["MAKEBACKUP"]) self.startStopBackupTimer() if interactive or config.plugins.epgbackup.show_messages_background.value: backupedFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"], getoutput = True) if backupedFile != "": Notifications.AddPopup( _("Backup \"%s\" successfully created!") % (backupedFile), \ MessageBox.TYPE_INFO, 10, domain = EPGBACKUP_NOTIFICATIONDOMAIN) else: errorTxt = self.__getErrortext() Notifications.AddNotificationWithCallback(self.showLogFileCB, MessageBox, \ text = _("Couldn't create a backup.\nReason: %s.\nPress OK to see the logfile!") \ % (errorTxt), type = MessageBox.TYPE_ERROR, \ timeout = 30, domain = EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("makeBackup-Error:\n" + str(format_exc()), forced=True)
def notifyBootCount(self): try: if os.path.exists(BOOTCOUNTERFILE): bootCount = "" fo=open(BOOTCOUNTERFILE) line = fo.readline() while (line): bootCount = line line = fo.readline() fo.close # We have succesfully booted, so delete the counter-File os.remove(BOOTCOUNTERFILE) bootCount= int(bootCount) if bootCount > int(config.plugins.epgbackup.max_boot_count.value): backupedFile = self.executeShScript(EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE"], EPGBACKUP_SHELL_CONSTANTS["GETLASTFILE_BACKUP"], getoutput = True) Notifications.AddNotificationWithCallback(self.askDeleteBadBackupCB, MessageBox, \ text = _("The EPG-Backup was not performed, because there were %d unsuccessfully boot-attempts!\nThe last restored backup-file was \"%s\".\nDo you want to delete the file?") \ % (bootCount, backupedFile), type = MessageBox.TYPE_YESNO, \ timeout = 10, domain = EPGBACKUP_NOTIFICATIONDOMAIN) except: debugOut("checkBootCount-Error:\n" + str(format_exc()), forced=True)
def executeShScript(self, param1 = "", param2 = "", sh_cmd = ""): if sh_cmd == "": sh_cmd = SH_EXEC_FILE debugOut("EPGBackup.sh execute with params %s %s" %(param1, param2)) else: debugOut("OS-execute %s with params %s %s" %(sh_cmd, param1, param2)) debugOut("Device-Info: %s" %(model)) if model == "dm800": return self._executeShOld(sh_cmd = sh_cmd, param1 = param1, param2 = param2) else: return self._executeSh(sh_cmd = sh_cmd, param1 = param1, param2 = param2)
def executeShScript(self, param1 = "", param2 = "", sh_cmd = ""): if sh_cmd == "": sh_cmd = SH_EXEC_FILE debugOut("EPGBackup.sh execute with params %s %s" %(param1, param2)) else: debugOut("OS-execute %s with params %s %s" %(sh_cmd, param1, param2)) debugOut("Device-Info: %s" %(HardwareInfo().get_device_name().upper())) if HardwareInfo().get_device_name().upper() == "DM800": return self._executeShOld(sh_cmd = sh_cmd, param1 = param1, param2 = param2) else: return self._executeSh(sh_cmd = sh_cmd, param1 = param1, param2 = param2)
def executeShScript(self, param1="", param2="", sh_cmd=""): if sh_cmd == "": sh_cmd = SH_EXEC_FILE debugOut("EPGBackup.sh execute with params %s %s" % (param1, param2)) else: debugOut("OS-execute %s with params %s %s" % (sh_cmd, param1, param2)) debugOut("Device-Info: %s" % (HardwareInfo().get_device_name().upper())) if HardwareInfo().get_device_name().upper() == "DM800": return self._executeShOld(sh_cmd=sh_cmd, param1=param1, param2=param2) else: return self._executeSh(sh_cmd=sh_cmd, param1=param1, param2=param2)
def startStopBackupTimer(self, configentry = None): try: if configentry == None: configentry = config.plugins.epgbackup.backupSaveInterval self.timerInterval = int(configentry.value) * 60 # minutes if self.timerInterval > 0: debugOut("backuptimer-Interval: " + str(self.timerInterval) + " seconds") self.backuptimer.startLongTimer(self.timerInterval) else: debugOut("backuptimer stopped!") self.backuptimer.stop() except: debugOut("startStopBackupTimer-Error:\n" + str(format_exc()), forced=True)
def removeNotifiers(self): try: config.plugins.epgbackup.backup_strategy.removeNotifier(self.updateVariableHelpText) except: debugOut("removeNotifiers-Error:\n" + str(format_exc()), forced=True)
def executeShScript(self, sh_action, param1 = "", getoutput = False): debugOut("EPGBackup.sh execute with params %s %s" %(sh_action, param1)) return self._executeSh(SH_EXEC_FILE, sh_action, param1, getoutput)
try: from Components.Language import language from Plugins.SystemPlugins.MPHelp import registerHelp, XMLHelpReader from Tools.Directories import resolveFilename, SCOPE_PLUGINS, fileExists lang = language.getLanguage()[:2] HELPPATH = resolveFilename(SCOPE_PLUGINS, "Extensions/EPGBackup") if fileExists(HELPPATH + "/locale/" + str(lang) + "/mphelp.xml"): helpfile = HELPPATH + "/locale/" + str(lang) + "/mphelp.xml" else: helpfile = HELPPATH + "/mphelp.xml" reader = XMLHelpReader(helpfile) epgBackuphHelp = registerHelp(*reader) except: debugOut("Help-Error:\n" + str(format_exc()), forced=True) epgBackuphHelp = None # Plugin epgbackup = None from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor gUserScriptExists = False # Autostart def autostart(reason, **kwargs): global epgbackup global gUserScriptExists if reason == 0 and "session" in kwargs: session = kwargs["session"]
def openconfig(session, **kwargs): try: from EPGBackupConfig import EPGBackupConfig session.openWithCallback(doneConfiguring, EPGBackupConfig) except: debugOut("Config-Import-Error:\n" + str(format_exc()), forced=True)
def updateVariableHelpText(self, configelement): try: if configelement == config.plugins.epgbackup.backup_strategy: self["help"].text = configelement.getChoices()[configelement.getIndex()][2] except: debugOut("updateVariableHelpText-Error:\n" + str(format_exc()), forced=True)
try: from Components.Language import language from Plugins.SystemPlugins.MPHelp import registerHelp, XMLHelpReader from Tools.Directories import resolveFilename, SCOPE_PLUGINS, fileExists lang = language.getLanguage()[:2] HELPPATH = resolveFilename(SCOPE_PLUGINS, "Extensions/EPGBackup") if fileExists(HELPPATH + "/locale/" + str(lang) + "/mphelp.xml"): helpfile = HELPPATH + "/locale/" + str(lang) + "/mphelp.xml" else: helpfile = HELPPATH + "/mphelp.xml" reader = XMLHelpReader(helpfile) epgBackuphHelp = registerHelp(*reader) except: debugOut("Help-Error:\n" + str(format_exc()), forced=True) epgBackuphHelp = None # Plugin epgbackup = None from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor gUserScriptExists = False # Autostart def autostart(reason, **kwargs): global epgbackup global gUserScriptExists