From 7f42129606734bd6a94454700d33cfae81741d76 Mon Sep 17 00:00:00 2001 From: "robweberjr@gmail.com" Date: Tue, 18 Mar 2014 13:48:53 -0500 Subject: [PATCH 1/2] added home window properties --- resources/lib/backup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/lib/backup.py b/resources/lib/backup.py index 771c9c8..374ce49 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -90,6 +90,10 @@ class XbmcBackup: self.skip_advanced = True def run(self,mode=-1,progressOverride=False): + #set windows setting to true + window = xbmcgui.Window(10000) + window.setProperty(utils.__addon_id__ + ".running","true") + #append backup folder name progressBarTitle = utils.getString(30010) + " - " if(mode == self.Backup and self.remote_vfs.root_path != ''): @@ -323,6 +327,9 @@ class XbmcBackup: if(self.progressBar != None): self.progressBar.close() + #reset the window setting + window.setProperty(utils.__addon_id__ + ".running","") + def backupFiles(self,fileList,source,dest): utils.log("Writing files to: " + dest.root_path) utils.log("Source: " + source.root_path) From 37fb30d7ab30ece842b733ac8f0482b46f5446df Mon Sep 17 00:00:00 2001 From: "robweberjr@gmail.com" Date: Mon, 31 Mar 2014 11:54:11 -0500 Subject: [PATCH 2/2] allow sending of "archive" parameter for restores --- default.py | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/default.py b/default.py index b2bd2ad..a682c8a 100644 --- a/default.py +++ b/default.py @@ -1,21 +1,37 @@ +import urlparse import xbmcgui import resources.lib.utils as utils from resources.lib.backup import XbmcBackup +def get_params(): + param = {} + + if(len(sys.argv) > 1): + for i in sys.argv: + args = i + if(args.startswith('?')): + args = args[1:] + param.update(dict(urlparse.parse_qsl(args))) + + return param + #the program mode mode = -1 +params = get_params() -#check if mode was passed in as an argument -if(len(sys.argv) > 1): - if(sys.argv[1].lower() == 'backup'): + +if("mode" in params): + if(params['mode'] == 'backup'): mode = 0 - elif(sys.argv[1].lower() == 'restore'): + 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)]) +#check if program should be run if(mode != -1): #run the profile backup backup = XbmcBackup() @@ -23,14 +39,29 @@ if(mode != -1): if(backup.remoteConfigured()): if(mode == backup.Restore): - #allow user to select the backup to restore from + #get list of valid restore points restorePoints = backup.listBackups() pointNames = [] - + folderNames = [] + for aDir in restorePoints: pointNames.append(aDir[1]) - - selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),pointNames) + folderNames.append(aDir[0]) + + selectedRestore = -1 + + 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])