This commit is contained in:
Rob Weber 2013-12-05 14:26:35 -06:00
parent 25a9faed9a
commit d28596728b
5 changed files with 37 additions and 14 deletions

View File

@ -1,5 +1,7 @@
Version 0.4.3
added error message if remote directory is blank
added license tag
Version 0.4.2

View File

@ -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()

View File

@ -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 = []

View File

@ -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)

View File

@ -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):