From 36e60a23497ae05736c24fed2f4ce936fb61f744 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 23:31:33 +0100 Subject: "New Year" Update: account plugins --- module/plugins/accounts/SimplyPremiumCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 465757457..accb3aba8 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.02" + __version__ = "0.03" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -42,7 +42,7 @@ class SimplyPremiumCom(Account): else: post_data = {"login_name": user, "login_pass": data['password']} - html = req.load("http://www.simply-premium.com/login.php", post=post_data) + html = req.load("http://www.simply-premium.com/login.php", post=post_data, decode=True) if 'logout' not in html: self.wrongPassword() -- cgit v1.2.3 From 0fe56f804a7ed4958f33a534e30e3b6c79526ea6 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Mon, 12 Jan 2015 17:38:00 +0100 Subject: Update SimplyPremiumCom.py Fixed API Call. Value "traffic" not existing in the API. --- module/plugins/accounts/SimplyPremiumCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index accb3aba8..c302f6589 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.03" + __version__ = "0.04" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -28,8 +28,8 @@ class SimplyPremiumCom(Account): 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 + if 'traffic' in json_data['result'] and json_data['result']['remain_traffic']: + trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} -- cgit v1.2.3 From 8c58586347a48d58353f4f7394abbb44f62c3cc7 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Mon, 12 Jan 2015 18:29:15 +0100 Subject: Update SimplyPremiumCom.py Forgot to change one Variable --- module/plugins/accounts/SimplyPremiumCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index c302f6589..79daf245e 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -28,7 +28,7 @@ class SimplyPremiumCom(Account): 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']['remain_traffic']: + if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} -- cgit v1.2.3 From 4cca634e6aa11a90fc8ce876b07b590aac4c7f14 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 12 Jan 2015 23:13:29 +0100 Subject: [SimplyPremiumCom] Improve account --- module/plugins/accounts/SimplyPremiumCom.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 79daf245e..8caf600f9 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.04" + __version__ = "0.05" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -15,15 +15,18 @@ class SimplyPremiumCom(Account): def loadAccountInfo(self, user, req): + premium = False validuntil = -1 trafficleft = None json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') - self.logDebug("JSON data: " + json_data) + + self.logDebug("JSON data: %s" % json_data) + json_data = json_loads(json_data) - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} + if 'vip' in json_data['result'] and json_data['result']['vip']: + premium = True if 'timeend' in json_data['result'] and json_data['result']['timeend']: validuntil = float(json_data['result']['timeend']) @@ -31,18 +34,15 @@ class SimplyPremiumCom(Account): if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): req.cj.setCookie("simply-premium.com", "lang", "EN") - if data['password'] == '' or data['password'] == '0': - post_data = {"key": user} - else: - post_data = {"login_name": user, "login_pass": data['password']} - - html = req.load("http://www.simply-premium.com/login.php", post=post_data, decode=True) + html = req.load("http://www.simply-premium.com/login.php", + post={'key': user} if not data['password'] else {'login_name': user, 'login_pass': data['password']}, + decode=True) if 'logout' not in html: self.wrongPassword() -- cgit v1.2.3