will now check for arguments "backup" or "restore" to bypass dialog prompt

This commit is contained in:
Rob Weber 2013-01-04 10:29:00 -06:00
parent 3cd1ae3247
commit 36332f20b8
4 changed files with 26 additions and 3 deletions

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmcbackup" <addon id="script.xbmcbackup"
name="XBMC Backup" version="0.3.3" provider-name="robweber"> name="XBMC Backup" version="0.3.4" provider-name="robweber">
<requires> <requires>
<import addon="xbmc.python" version="2.1.0"/> <import addon="xbmc.python" version="2.1.0"/>
</requires> </requires>

View File

@ -1,3 +1,7 @@
Version 0.3.4
added ability to take parameters via RunScript() or JSONRPC.Addons.ExecuteAddon()
Version 0.3.3 Version 0.3.3
updated xbmc python version (2.1.0) updated xbmc python version (2.1.0)

View File

@ -2,8 +2,19 @@ import xbmcgui
import resources.lib.utils as utils import resources.lib.utils as utils
from resources.lib.backup import XbmcBackup from resources.lib.backup import XbmcBackup
#figure out if this is a backup or a restore #the program mode
mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)]) 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): if(mode != -1):
#run the profile backup #run the profile backup