mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
remove token file if Dropbox authorization revoked
This commit is contained in:
parent
018a1a1e82
commit
46cd3c6731
@ -2,6 +2,8 @@ Version 0.3.1
|
|||||||
|
|
||||||
added try/except for multiple character encodings
|
added try/except for multiple character encodings
|
||||||
|
|
||||||
|
remove token.txt file if Dropbox Authorization is revoked
|
||||||
|
|
||||||
Version 0.3.0
|
Version 0.3.0
|
||||||
|
|
||||||
major vfs rewrite
|
major vfs rewrite
|
||||||
|
@ -84,7 +84,13 @@ class DropboxFileSystem(Vfs):
|
|||||||
sess.set_token(user_token_key,user_token_secret)
|
sess.set_token(user_token_key,user_token_secret)
|
||||||
|
|
||||||
self.client = client.DropboxClient(sess)
|
self.client = client.DropboxClient(sess)
|
||||||
|
|
||||||
|
try:
|
||||||
utils.log(str(self.client.account_info()))
|
utils.log(str(self.client.account_info()))
|
||||||
|
except:
|
||||||
|
#this didn't work, delete the token file
|
||||||
|
self.deleteToken()
|
||||||
|
|
||||||
|
|
||||||
def listdir(self,directory):
|
def listdir(self,directory):
|
||||||
if(self.client != None and self.exists(directory)):
|
if(self.client != None and self.exists(directory)):
|
||||||
@ -150,6 +156,7 @@ class DropboxFileSystem(Vfs):
|
|||||||
out.close()
|
out.close()
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def setToken(self,key,secret):
|
def setToken(self,key,secret):
|
||||||
#write the token files
|
#write the token files
|
||||||
token_file = open(xbmc.translatePath(utils.data_dir() + "tokens.txt"),'w')
|
token_file = open(xbmc.translatePath(utils.data_dir() + "tokens.txt"),'w')
|
||||||
@ -167,6 +174,10 @@ class DropboxFileSystem(Vfs):
|
|||||||
else:
|
else:
|
||||||
return ["",""]
|
return ["",""]
|
||||||
|
|
||||||
|
def deleteToken(self):
|
||||||
|
if(xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "tokens.txt"))):
|
||||||
|
xbmcvfs.delete(xbmc.translatePath(utils.data_dir() + "tokens.txt"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user