summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-12 23:13:29 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-12 23:13:29 +0100
commit4cca634e6aa11a90fc8ce876b07b590aac4c7f14 (patch)
tree3b5314c7492cb3ca9a9ed595c2023aa976f56423
parentMerge pull request #1037 from EvolutionClip/stable (diff)
downloadpyload-4cca634e6aa11a90fc8ce876b07b590aac4c7f14.tar.xz
[SimplyPremiumCom] Improve account
-rw-r--r--module/plugins/accounts/SimplyPremiumCom.py22
1 files changed, 11 insertions, 11 deletions
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()