Esempio n. 1
0
    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
Esempio n. 2
0
    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
    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))
Esempio n. 4
0
 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))
        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])
                folderNames.append(aDir[0])

            selectedRestore = -1

            if ("archive" in params):
                #check that the user give archive exists
Esempio n. 6
0
#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])
                folderNames.append(aDir[0])

            selectedRestore = -1

            if("archive" in params):
                #check that the user give archive exists
Esempio n. 7
0
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(30099)]
    )

# check if program should be run
if mode != -1:
    # run the profile backup
    backup = XbmcBackup()

    if mode == 1:
        # 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])
                folderNames.append(aDir[0])

            selectedRestore = -1

            if "archive" in params:
                # check that the user give archive exists