change this as settings are saved until close, call specific type with arg

This commit is contained in:
Rob Weber 2017-01-31 09:07:49 -06:00
parent b1d16df817
commit c46f684ea5
2 changed files with 23 additions and 8 deletions

View File

@ -1,20 +1,34 @@
import xbmc import sys
import urlparse
import xbmcgui import xbmcgui
import xbmcvfs
import resources.lib.utils as utils import resources.lib.utils as utils
from resources.lib.authorizers import DropboxAuthorizer,GoogleDriveAuthorizer from resources.lib.authorizers import DropboxAuthorizer,GoogleDriveAuthorizer
def get_params():
param = {}
try:
for i in sys.argv:
args = i
if(args.startswith('?')):
args = args[1:]
param.update(dict(urlparse.parse_qsl(args)))
except:
pass
return param
params = get_params()
#drobpox #drobpox
if(utils.getSetting('remote_selection') == '2'): if(params['type'] == 'dropbox'):
authorizer = DropboxAuthorizer() authorizer = DropboxAuthorizer()
if(authorizer.authorize()): if(authorizer.authorize()):
xbmcgui.Dialog().ok("Backup",utils.getString(30027) + ' ' + utils.getString(30106)) xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30027) + ' ' + utils.getString(30106))
else: else:
xbmcgui.Dialog().ok("Backup",utils.getString(30107) + ' ' + utils.getString(30027)) xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30107) + ' ' + utils.getString(30027))
#google drive #google drive
elif(utils.getSetting('remote_selection') == '3'): elif(params['type'] == 'google_drive'):
authorizer = GoogleDriveAuthorizer() authorizer = GoogleDriveAuthorizer()
if(authorizer.authorize()): if(authorizer.authorize()):

View File

@ -13,8 +13,9 @@
<setting id="dropbox_secret" type="text" label="30029" visible="eq(-4,2)" default="" /> <setting id="dropbox_secret" type="text" label="30029" visible="eq(-4,2)" default="" />
<setting id="google_drive_id" type="text" label="Client ID" visible="eq(-5,3)" default="" /> <setting id="google_drive_id" type="text" label="Client ID" visible="eq(-5,3)" default="" />
<setting id="google_drive_secret" type="text" label="Client Secret" visible="eq(-6,3)" default="" /> <setting id="google_drive_secret" type="text" label="Client Secret" visible="eq(-6,3)" default="" />
<setting id="remove_auth_button" type="action" label="30104" action="RunScript(special://home/addons/script.xbmcbackup/authorize_cloud.py)" visible="gt(-7,1)"/> <setting id="remove_auth_button" type="action" label="30104" action="RunScript(special://home/addons/script.xbmcbackup/authorize_cloud.py,type=dropbox)" visible="eq(-7,2)"/>
<setting id="remove_auth_button" type="action" label="30093" action="RunScript(special://home/addons/script.xbmcbackup/remove_auth.py)" visible="gt(-8,1)"/> <setting id="remove_auth_button" type="action" label="30104" action="RunScript(special://home/addons/script.xbmcbackup/authorize_cloud.py,type=google_drive)" visible="eq(-8,3)"/>
<setting id="remove_auth_button" type="action" label="30093" action="RunScript(special://home/addons/script.xbmcbackup/remove_auth.py)" visible="gt(-9,1)"/>
</category> </category>
<category id="selection" label="30012"> <category id="selection" label="30012">
<setting id="backup_addons" type="bool" label="30030" default="true" /> <setting id="backup_addons" type="bool" label="30030" default="true" />