diff --git a/changelog.txt b/changelog.txt index 9bbd36f..dfdea64 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ Version 0.4.3 +added error message if remote directory is blank + added license tag Version 0.4.2 diff --git a/default.py b/default.py index e4ef6dd..723559e 100644 --- a/default.py +++ b/default.py @@ -20,13 +20,19 @@ 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() + if(backup.remoteConfigured()): - selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints) + if(mode == backup.Restore): + #allow user to select the backup to restore from + restorePoints = backup.listBackups() - if(selectedRestore != -1): - backup.selectRestore(restorePoints[selectedRestore]) + selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints) + + if(selectedRestore != -1): + backup.selectRestore(restorePoints[selectedRestore]) - backup.run(mode) + backup.run(mode) + else: + #can't go any further + xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045)) + utils.openSettings() diff --git a/resources/lib/backup.py b/resources/lib/backup.py index d04c1d8..a53e209 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -44,6 +44,14 @@ class XbmcBackup: self.remote_base_path = "/" self.remote_vfs = DropboxFileSystem("/") + def remoteConfigured(self): + result = True + + if(self.remote_base_path == ""): + result = False + + return result + def listBackups(self): result = [] diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 02ee1d9..bc1814a 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -10,6 +10,9 @@ def data_dir(): def addon_dir(): return __Addon.getAddonInfo('path') +def openSettings(): + __Addon.openSettings() + def log(message,loglevel=xbmc.LOGNOTICE): xbmc.log(encode(__addon_id__ + ": " + message),level=loglevel) diff --git a/scheduler.py b/scheduler.py index 050e45f..d2df48e 100644 --- a/scheduler.py +++ b/scheduler.py @@ -50,14 +50,18 @@ class BackupScheduler: utils.showNotification(utils.getString(30053)) #run the job in backup mode, hiding the dialog box backup = XbmcBackup() - backup.run(XbmcBackup.Backup,True) - #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') + if(backup.remoteConfigured()): + backup.run(XbmcBackup.Backup,True) + #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 @@ -81,7 +85,7 @@ class BackupScheduler: if(new_run_time != self.next_run): self.next_run = new_run_time - utils.showNotification(utils.getString(30080) + " " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M')) + utils.showNotification(utils.getString(30081) + " " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M')) utils.log("scheduler will run again on " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M')) def settingsChanged(self):