From 36332f20b8bf8b97361974bf068cfc57af4fc285 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Fri, 4 Jan 2013 10:29:00 -0600 Subject: [PATCH] will now check for arguments "backup" or "restore" to bypass dialog prompt --- README.txt | 8 ++++++++ addon.xml | 2 +- changelog.txt | 4 ++++ default.py | 15 +++++++++++++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index 3a3856a..370fac2 100644 --- a/README.txt +++ b/README.txt @@ -26,6 +26,14 @@ Using Dropbox as a storage target adds a few steps the first time you wish to ru Once you have your app key and secret add them to the settings. XBMC Backup now needs to have permission to access your Dropbox account. When you see the prompt regarding the Dropbox URL Authorization DO NOT click OK. Check your XBMC log file for a line from "script.xbmcbackup" containing the authorization URL. Cut/paste this into a browser and click Allow. Once this is done you can click "OK" in XBMC and proceed as normal. XBMC Backup will cache the authorization code so you only have to do this once, or if you revoke the Dropbox permissions. + +Scripting XBMC Backup: + +If you wish to script this addon using an outside scheduler or script it can be given parameters via the Xbmc.RunScript() or JsonRPC.Addons.ExecuteAddon() methods. Parameters given are either "backup" or "restore" to launch the correct program mode. An example would be: + +RunScript(script.xbmcbackup,backup) + + What this Addon Will Not Do: This is not meant as an XBMC file sync solution. If you have multiple frontends you want to keep in sync this addon may work in a "poor man's" sort of way but it is not intended for that. diff --git a/addon.xml b/addon.xml index 1d4bbc1..3a0f316 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@  + name="XBMC Backup" version="0.3.4" provider-name="robweber"> diff --git a/changelog.txt b/changelog.txt index a486694..d2f9ded 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version 0.3.4 + +added ability to take parameters via RunScript() or JSONRPC.Addons.ExecuteAddon() + Version 0.3.3 updated xbmc python version (2.1.0) diff --git a/default.py b/default.py index 0c1e9cf..e4ef6dd 100644 --- a/default.py +++ b/default.py @@ -2,8 +2,19 @@ import xbmcgui import resources.lib.utils as utils from resources.lib.backup import XbmcBackup -#figure out if this is a backup or a restore -mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)]) +#the program mode +mode = -1 + +#check if mode was passed in as an argument +if(len(sys.argv) > 1): + if(sys.argv[1].lower() == 'backup'): + mode = 0 + elif(sys.argv[1].lower() == 'restore'): + mode = 1 + +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)]) if(mode != -1): #run the profile backup