summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/PremiumizeMe.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts/PremiumizeMe.py')
-rw-r--r--module/plugins/accounts/PremiumizeMe.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py
index 768fcd783..1a446b842 100644
--- a/module/plugins/accounts/PremiumizeMe.py
+++ b/module/plugins/accounts/PremiumizeMe.py
@@ -4,7 +4,7 @@ from module.common.json_layer import json_loads
class PremiumizeMe(Account):
__name__ = "PremiumizeMe"
- __version__ = "0.1"
+ __version__ = "0.11"
__type__ = "account"
__description__ = """Premiumize.Me account plugin"""
@@ -15,10 +15,14 @@ class PremiumizeMe(Account):
# Get user data from premiumize.me
status = self.getAccountStatus(user, req)
+ self.logDebug(status)
# Parse account info
account_info = {"validuntil": float(status['result']['expires']),
- "trafficleft": status['result']['trafficleft_bytes'] / 1024}
+ "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)}
+
+ if status['result']['type'] == 'free':
+ account_info['premium'] = False
return account_info
@@ -37,4 +41,4 @@ class PremiumizeMe(Account):
# Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) to retrieve account info and return the parsed json answer
answer = req.load("https://api.premiumize.me/pm-api/v1.php?method=accountstatus&params[login]=%s&params[pass]=%s" % (user, self.accounts[user]['password']))
return json_loads(answer)
- \ No newline at end of file
+