diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-03 19:58:02 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-03 19:58:02 +0200 |
commit | 43e6a6376625ac73067403ddae3b45a80618d6c8 (patch) | |
tree | ceb458c3da1f19e0a91731bc254ee3a158682d0b /pyload/plugins/account/BayfilesCom.py | |
parent | [ConfigParser] Remove IGNORE feature (diff) | |
download | pyload-43e6a6376625ac73067403ddae3b45a80618d6c8.tar.xz |
Rename accounts directory to account
Diffstat (limited to 'pyload/plugins/account/BayfilesCom.py')
-rw-r--r-- | pyload/plugins/account/BayfilesCom.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pyload/plugins/account/BayfilesCom.py b/pyload/plugins/account/BayfilesCom.py new file mode 100644 index 000000000..221d1615d --- /dev/null +++ b/pyload/plugins/account/BayfilesCom.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from time import time + +from pyload.plugins.base.Account import Account +from pyload.utils import json_loads + + +class BayfilesCom(Account): + __name__ = "BayfilesCom" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Bayfiles.com account plugin""" + __author_name__ = "zoidberg" + __author_mail__ = "zoidberg@mujmail.cz" + + + def loadAccountInfo(self, user, req): + for _ in xrange(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(user) + + return {"premium": bool(response['premium']), "trafficleft": -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']))) + self.logDebug(response) + if response['error']: + self.logError(response['error']) + self.wrongPassword() |