diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-07 22:27:53 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-07 22:27:53 +0100 |
commit | 5a1cd89497598daffdd643114db7a033cf46a807 (patch) | |
tree | aeee3e995711456f569bfe80738f8d26282e28b4 /module/plugins/accounts/BayfilesCom.py | |
parent | bayfiles.com premium, fix hellshare.cz (diff) | |
download | pyload-5a1cd89497598daffdd643114db7a033cf46a807.tar.xz |
AllDebrid plugin by Andy, Voigt; closed #555; generic XFileSharingPro plugin
Diffstat (limited to 'module/plugins/accounts/BayfilesCom.py')
-rw-r--r-- | module/plugins/accounts/BayfilesCom.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py index 803e602cb..0d036488b 100644 --- a/module/plugins/accounts/BayfilesCom.py +++ b/module/plugins/accounts/BayfilesCom.py @@ -20,23 +20,28 @@ from module.plugins.Account import Account from module.common.json_layer import json_loads import re -from time import mktime, strptime +from time import time, mktime, strptime class BayfilesCom(Account): __name__ = "BayfilesCom" - __version__ = "0.01" + __version__ = "0.02" __type__ = "account" __description__ = """bayfiles.com account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") def loadAccountInfo(self, user, req): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(response) - + for i in range(2): + response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) + self.logDebug(response) + if not response["error"]: + break + self.logWarning(response["error"]) + self.relogin() + return {"premium": bool(response['premium']), \ "trafficleft": -1, \ - "validuntil": response['expires'] if response['expires'] > 0 else -1} + "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} def login(self, user, data, req): response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data["password"]))) |