def start(self): while(not xbmc.abortRequested): current_enabled = utils.getSetting("enable_scheduler") if(current_enabled == "true" and self.enabled == "false"): #scheduler was just turned on self.enabled = current_enabled self.setup() elif (current_enabled == "false" and self.enabled == "true"): #schedule was turn off self.enabled = current_enabled elif(self.enabled == "true"): #scheduler is still on now = time.time() if(self.next_run <= now): if(utils.getSetting('run_silent') == 'false'): utils.showNotification(utils.getString(30053)) #run the job in backup mode, hiding the dialog box backup = XbmcBackup() backup.run(XbmcBackup.Backup,True) self.findNextRun(now) time.sleep(10)
def start(self): #check if a backup should be resumed resumeRestore = self._resumeCheck() if(resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) #skip the advanced settings check restore.skipAdvanced() restore.run(XbmcBackup.Restore) while(not xbmc.abortRequested): if(self.enabled == "true"): #scheduler is still on now = time.time() if(self.next_run <= now): if(utils.getSetting('run_silent') == 'false'): utils.showNotification(utils.getString(30053)) #run the job in backup mode, hiding the dialog box backup = XbmcBackup() backup.run(XbmcBackup.Backup,True) #check if we should shut the computer down if(utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: #find the next run time like normal self.findNextRun(now) xbmc.sleep(500)
def start(self): #check if a backup should be resumed resumeRestore = self._resumeCheck() if (resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) #skip the advanced settings check restore.skipAdvanced() restore.run(XbmcBackup.Restore) while (not xbmc.abortRequested): if (self.enabled == "true"): #scheduler is still on now = time.time() if (self.next_run <= now): progress_mode = int(utils.getSetting('progress_mode')) self.doScheduledBackup(progress_mode) #check if we should shut the computer down if (utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: #find the next run time like normal self.findNextRun(now) xbmc.sleep(500) #delete monitor to free up memory del self.monitor
def start(self): #check if a backup should be resumed resumeRestore = self._resumeCheck() if(resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) #skip the advanced settings check restore.skipAdvanced() restore.run(XbmcBackup.Restore) while(not xbmc.abortRequested): if(self.enabled == "true"): #scheduler is still on now = time.time() if(self.next_run <= now): progress_mode = int(utils.getSetting('progress_mode')) self.doScheduledBackup(progress_mode) #check if we should shut the computer down if(utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: #find the next run time like normal self.findNextRun(now) xbmc.sleep(500) #delete monitor to free up memory del self.monitor
def start(self): # display upgrade messages if they exist if (utils.getSettingInt('upgrade_notes') < UPGRADE_INT): xbmcgui.Dialog().ok(utils.getString(30010), utils.getString(30132)) utils.setSetting('upgrade_notes', str(UPGRADE_INT)) # check if a backup should be resumed resumeRestore = self._resumeCheck() if (resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) # skip the advanced settings check restore.skipAdvanced() restore.restore() while (not self.monitor.abortRequested()): if (self.enabled): # scheduler is still on now = time.time() if (self.next_run <= now): progress_mode = utils.getSettingInt('progress_mode') self.doScheduledBackup(progress_mode) # check if we should shut the computer down if (utils.getSettingBool("cron_shutdown")): # wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: # find the next run time like normal self.findNextRun(now) xbmc.sleep(500) # delete monitor to free up memory del self.monitor
def doScheduledBackup(self, progress_mode): if (progress_mode != 2): utils.showNotification(utils.getString(30053)) backup = XbmcBackup() if (backup.remoteConfigured()): if (int(utils.getSetting('progress_mode')) in [0, 1]): backup.run(XbmcBackup.Backup, True) else: backup.run(XbmcBackup.Backup, False) #check if this is a "one-off" if (int(utils.getSetting("schedule_interval")) == 0): #disable the scheduler after this run self.enabled = "false" utils.setSetting('enable_scheduler', 'false') else: utils.showNotification(utils.getString(30045))
def doScheduledBackup(self,progress_mode): if(progress_mode != 2): utils.showNotification(utils.getString(30053)) backup = XbmcBackup() if(backup.remoteConfigured()): if(int(utils.getSetting('progress_mode')) in [0,1]): backup.run(XbmcBackup.Backup,True) else: backup.run(XbmcBackup.Backup,False) #check if this is a "one-off" if(int(utils.getSetting("schedule_interval")) == 0): #disable the scheduler after this run self.enabled = "false" utils.setSetting('enable_scheduler','false') else: utils.showNotification(utils.getString(30045))
mode = 1 #if mode wasn't passed in as arg, get from user if (mode == -1): #figure out if this is a backup or a restore from the user mode = xbmcgui.Dialog().select( utils.getString(30010) + " - " + utils.getString(30023), [ utils.getString(30016), utils.getString(30017), utils.getString(30099) ]) #check if program should be run if (mode != -1): #run the profile backup backup = XbmcBackup() if (mode == 2): #open the settings dialog utils.openSettings() elif (backup.remoteConfigured()): if (mode == backup.Restore): #get list of valid restore points restorePoints = backup.listBackups() pointNames = [] folderNames = [] for aDir in restorePoints: pointNames.append(aDir[1])
if("mode" in params): if(params['mode'] == 'backup'): mode = 0 elif(params['mode'] == 'restore'): mode = 1 #if mode wasn't passed in as arg, get from user if(mode == -1): #figure out if this is a backup or a restore from the user # mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017),utils.getString(30099)]) mode = 1 #check if program should be run if(mode != -1): #run the profile backup backup = XbmcBackup() if(mode == 2): #open the settings dialog utils.openSettings() elif(backup.remoteConfigured()): if(mode == backup.Restore): #get list of valid restore points restorePoints = backup.listBackups() pointNames = [] folderNames = [] for aDir in restorePoints: pointNames.append(aDir[1])
def start(self): #check if a backup should be resumed resumeRestore = self._resumeCheck() if(resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) #skip the advanced settings check restore.skipAdvanced() restore.run(XbmcBackup.Restore) while(not xbmc.abortRequested): if(self.enabled == "true"): #scheduler is still on now = time.time() if(self.next_run <= now): progress_mode = int(utils.getSetting('progress_mode')) if(progress_mode != 2): utils.showNotification(utils.getString(30053)) backup = XbmcBackup() if(backup.remoteConfigured()): if(int(utils.getSetting('progress_mode')) in [0,1]): backup.run(XbmcBackup.Backup,True) else: backup.run(XbmcBackup.Backup,False) #check if this is a "one-off" if(int(utils.getSetting("schedule_interval")) == 0): #disable the scheduler after this run self.enabled = "false" utils.setSetting('enable_scheduler','false') else: utils.showNotification(utils.getString(30045)) #check if we should shut the computer down if(utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: #find the next run time like normal self.findNextRun(now) xbmc.sleep(500) #delete monitor to free up memory del self.monitor
from resources.lib.backup import XbmcBackup #run the profile backup backup = XbmcBackup() if(backup.isReady()): backup.run()
utils.getString(30017), utils.getString(30099) ] # find out if we're using the advanced editor if (utils.getSettingInt('backup_selection_type') == 1): options.append(utils.getString(30125)) # figure out if this is a backup or a restore from the user mode = xbmcgui.Dialog().select( utils.getString(30010) + " - " + utils.getString(30023), options) # check if program should be run if (mode != -1): # run the profile backup backup = XbmcBackup() if (mode == 2): # open the settings dialog utils.openSettings() elif (mode == 3 and utils.getSettingInt('backup_selection_type') == 1): # open the advanced editor xbmc.executebuiltin( 'RunScript(special://home/addons/script.xbmcbackup/launcher.py, action=advanced_editor)' ) elif (backup.remoteConfigured()): if (mode == backup.Restore): # get list of valid restore points restorePoints = backup.listBackups() pointNames = []
from resources.lib.backup import XbmcBackup #the program mode mode = -1 #check if mode was passed in as an argument if(len(sys.argv) > 1): if(sys.argv[1].lower() == 'backup'): mode = 0 elif(sys.argv[1].lower() == 'restore'): mode = 1 if(mode == -1): #figure out if this is a backup or a restore from the user mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)]) if(mode != -1): #run the profile backup backup = XbmcBackup() if(mode == backup.Restore): #allow user to select the backup to restore from restorePoints = backup.listBackups() selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints) if(selectedRestore != -1): backup.selectRestore(restorePoints[selectedRestore]) backup.run(mode)
def start(self): #check if a backup should be resumed resumeRestore = self._resumeCheck() if (resumeRestore): restore = XbmcBackup() restore.selectRestore(self.restore_point) #skip the advanced settings check restore.skipAdvanced() restore.run(XbmcBackup.Restore) while (not xbmc.abortRequested): if (self.enabled == "true"): #scheduler is still on now = time.time() if (self.next_run <= now): progress_mode = int(utils.getSetting('progress_mode')) if (progress_mode != 2): utils.showNotification(utils.getString(30053)) backup = XbmcBackup() if (backup.remoteConfigured()): if (int(utils.getSetting('progress_mode')) in [0, 1]): backup.run(XbmcBackup.Backup, True) else: backup.run(XbmcBackup.Backup, False) #check if this is a "one-off" if (int(utils.getSetting("schedule_interval")) == 0): #disable the scheduler after this run self.enabled = "false" utils.setSetting('enable_scheduler', 'false') else: utils.showNotification(utils.getString(30045)) #check if we should shut the computer down if (utils.getSetting("cron_shutdown") == 'true'): #wait 10 seconds to make sure all backup processes and files are completed time.sleep(10) xbmc.executebuiltin('ShutDown()') else: #find the next run time like normal self.findNextRun(now) xbmc.sleep(500) #delete monitor to free up memory del self.monitor