diff options
Diffstat (limited to 'module/plugins/accounts/ZeveraCom.py')
-rw-r--r-- | module/plugins/accounts/ZeveraCom.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 1eb90801a..e8e3431e3 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -6,12 +6,14 @@ from module.plugins.Account import Account class ZeveraCom(Account): - __name__ = "ZeveraCom" - __version__ = "0.21" - __type__ = "account" + __name__ = "ZeveraCom" + __type__ = "account" + __version__ = "0.22" + __description__ = """Zevera.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + def loadAccountInfo(self, user, req): data = self.getAPIData(req) @@ -19,18 +21,20 @@ class ZeveraCom(Account): account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} else: account_info = { - "trafficleft": int(data['availabletodaytraffic']) * 1024, + "trafficleft": float(data['availabletodaytraffic']) * 1024, "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), "premium": True } return account_info + def login(self, user, data, req): self.loginname = user - self.password = data["password"] + self.password = data['password'] if self.getAPIData(req) == "No traffic": self.wrongPassword() + def getAPIData(self, req, just_header=False, **kwargs): get_data = { 'cmd': 'accountinfo', @@ -39,14 +43,14 @@ class ZeveraCom(Account): } get_data.update(kwargs) - response = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, + res = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, decode=True, just_header=just_header) - self.logDebug(response) + self.logDebug(res) - if ':' in response: + if ':' in res: if not just_header: - response = response.replace(',', '\n') + res = res.replace(',', '\n') return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in response.splitlines() if ':' in x]) + [x.split(':', 1) for x in res.splitlines() if ':' in x]) else: - return response + return res |