This commit is contained in:
Rob Weber 2017-11-07 14:19:27 -06:00
parent 2927e31c59
commit db4b404a88
3 changed files with 26 additions and 9 deletions

View File

@ -1,3 +1,7 @@
Version 1.1.1
fixed error on authorizers (missing secret/key)
Version 1.1.0 Version 1.1.0
added tinyurl for oauth urls added tinyurl for oauth urls

View File

@ -49,7 +49,7 @@
<string id="30054">Removing backup</string> <string id="30054">Removing backup</string>
<string id="30056">Go to this URL to authorize</string> <string id="30056">Go to this URL to authorize</string>
<string id="30057">Click OK AFTER completion</string> <string id="30057">Click OK AFTER completion</string>
<string id="30058">Dropbox Developer Code Needed</string> <string id="30058">Developer Code Needed</string>
<string id="30059">Visit https://www.dropbox.com/developers</string> <string id="30059">Visit https://www.dropbox.com/developers</string>
<string id="30060">Enable Scheduler</string> <string id="30060">Enable Scheduler</string>
<string id="30061">Schedule</string> <string id="30061">Schedule</string>
@ -99,4 +99,5 @@
<string id="30105">Authorize this remote service in the settings first</string> <string id="30105">Authorize this remote service in the settings first</string>
<string id="30106">is authorized</string> <string id="30106">is authorized</string>
<string id="30107">error authorizing</string> <string id="30107">error authorizing</string>
<string id="30108">Visit https://console.developers.google.com/</string>
</strings> </strings>

View File

@ -15,13 +15,16 @@ class DropboxAuthorizer:
self.APP_KEY = utils.getSetting('dropbox_key') self.APP_KEY = utils.getSetting('dropbox_key')
self.APP_SECRET = utils.getSetting('dropbox_secret') self.APP_SECRET = utils.getSetting('dropbox_secret')
self.setup()
def setup(self): def setup(self):
result = True
if(self.APP_KEY == '' and self.APP_SECRET == ''): if(self.APP_KEY == '' and self.APP_SECRET == ''):
#we can't go any farther, need these for sure #we can't go any farther, need these for sure
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30058),utils.getString(30059)) xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30027) + ' ' + utils.getString(30058),utils.getString(30059))
return
result = False
return result
def isAuthorized(self): def isAuthorized(self):
user_token_key,user_token_secret = self._getToken() user_token_key,user_token_secret = self._getToken()
@ -30,6 +33,10 @@ class DropboxAuthorizer:
def authorize(self): def authorize(self):
result = True result = True
if(not self.setup()):
return False
if(self.isAuthorized()): if(self.isAuthorized()):
#delete the token to start over #delete the token to start over
self._deleteToken() self._deleteToken()
@ -97,13 +104,15 @@ class GoogleDriveAuthorizer:
self.CLIENT_ID = utils.getSetting('google_drive_id') self.CLIENT_ID = utils.getSetting('google_drive_id')
self.CLIENT_SECRET = utils.getSetting('google_drive_secret') self.CLIENT_SECRET = utils.getSetting('google_drive_secret')
self.setup()
def setup(self): def setup(self):
result = True
if(self.CLIENT_ID == '' and self.CLIENT_SECRET == ''): if(self.CLIENT_ID == '' and self.CLIENT_SECRET == ''):
#we can't go any farther, need these for sure #we can't go any farther, need these for sure
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30058),utils.getString(30059)) xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30098) + ' ' + utils.getString(30058),utils.getString(30108))
return result = False
return result
def isAuthorized(self): def isAuthorized(self):
return xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "google_drive.dat")) return xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "google_drive.dat"))
@ -111,6 +120,9 @@ class GoogleDriveAuthorizer:
def authorize(self): def authorize(self):
result = True result = True
if(not self.setup()):
return False
#create authorization helper and load default settings #create authorization helper and load default settings
gauth = GoogleAuth(xbmc.validatePath(xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml'))) gauth = GoogleAuth(xbmc.validatePath(xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml')))
gauth.LoadClientConfigSettings() gauth.LoadClientConfigSettings()