예제 #1
0
    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
예제 #2
0
            if ("archive" in params):
                # check that the user give archive exists
                if (params['archive'] in folderNames):
                    # set the index
                    selectedRestore = folderNames.index(params['archive'])
                    utils.log(str(selectedRestore) + " : " + params['archive'])
                else:
                    utils.showNotification(utils.getString(30045))
                    utils.log(params['archive'] +
                              ' is not a valid restore point')
            else:
                # allow user to select the backup to restore from
                selectedRestore = xbmcgui.Dialog().select(
                    utils.getString(30010) + " - " + utils.getString(30021),
                    pointNames)

            if (selectedRestore != -1):
                backup.selectRestore(restorePoints[selectedRestore][0])

            if ('sets' in params):
                backup.restore(selectedSets=params['sets'].split('|'))
            else:
                backup.restore()
        else:
            backup.backup()
    else:
        # can't go any further
        xbmcgui.Dialog().ok(utils.getString(30010), utils.getString(30045))
        utils.openSettings()