Permalink
Browse files

remove token file if Dropbox authorization revoked

  • Loading branch information...
1 parent 018a1a1 commit 46cd3c673171bebfc7abb64fd147b7ae851ff29c @robweber committed Dec 13, 2012
Showing with 14 additions and 1 deletion.
  1. +2 −0 changelog.txt
  2. +12 −1 resources/lib/vfs.py
View
@@ -2,6 +2,8 @@ Version 0.3.1
added try/except for multiple character encodings
+remove token.txt file if Dropbox Authorization is revoked
+
Version 0.3.0
major vfs rewrite
View
@@ -84,7 +84,13 @@ def __init__(self):
sess.set_token(user_token_key,user_token_secret)
self.client = client.DropboxClient(sess)
- utils.log(str(self.client.account_info()))
+
+ try:
+ utils.log(str(self.client.account_info()))
+ except:
+ #this didn't work, delete the token file
+ self.deleteToken()
+
def listdir(self,directory):
if(self.client != None and self.exists(directory)):
@@ -150,6 +156,7 @@ def get_file(self,source,dest):
out.close()
else:
return False
+
def setToken(self,key,secret):
#write the token files
token_file = open(xbmc.translatePath(utils.data_dir() + "tokens.txt"),'w')
@@ -166,6 +173,10 @@ def getToken(self):
return [key,secret]
else:
return ["",""]
+
+ def deleteToken(self):
+ if(xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "tokens.txt"))):
+ xbmcvfs.delete(xbmc.translatePath(utils.data_dir() + "tokens.txt"))

0 comments on commit 46cd3c6

Please sign in to comment.