diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-18 16:02:29 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-18 16:02:29 +0100 |
commit | fb65d5354c3cc80c3f48c3a2745b8dc01105edfd (patch) | |
tree | 822240f20e27f2d5edc3e10624fc622e7c26cdc6 /module/plugins/accounts/SimplyPremiumCom.py | |
parent | [UploadedTo] Fix trafficleft recognition (diff) | |
download | pyload-fb65d5354c3cc80c3f48c3a2745b8dc01105edfd.tar.xz |
Update account plugins
Diffstat (limited to 'module/plugins/accounts/SimplyPremiumCom.py')
-rw-r--r-- | module/plugins/accounts/SimplyPremiumCom.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 979ce73aa..465757457 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -15,6 +15,9 @@ class SimplyPremiumCom(Account): def loadAccountInfo(self, user, req): + validuntil = -1 + trafficleft = None + json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') self.logDebug("JSON data: " + json_data) json_data = json_loads(json_data) @@ -22,14 +25,13 @@ class SimplyPremiumCom(Account): if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: return {"premium": False} - #Time package - validuntil = float(json_data['result']['timeend']) - #Traffic package - # {"trafficleft": int(traffic), "validuntil": -1} - #trafficleft = int(json_data['result']['traffic']) + if 'timeend' in json_data['result'] and json_data['result']['timeend']: + validuntil = float(json_data['result']['timeend']) + + if 'traffic' in json_data['result'] and json_data['result']['traffic']: + trafficleft = float(json_data['result']['traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - return {"premium": True, "validuntil": validuntil} + return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): |