summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/PremiumizeMe.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-21 12:58:42 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-21 12:58:42 +0200
commit37d898f681e41fe9c9a8719a540eda59bfedd448 (patch)
treefaecf5455aa91155ed7c762701221f171d14bb0d /module/plugins/accounts/PremiumizeMe.py
parentUsing the same translatable string (diff)
downloadpyload-37d898f681e41fe9c9a8719a540eda59bfedd448.tar.xz
Normalize line endings to avoid line endings merge conflicts
Diffstat (limited to 'module/plugins/accounts/PremiumizeMe.py')
-rw-r--r--module/plugins/accounts/PremiumizeMe.py88
1 files changed, 44 insertions, 44 deletions
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py
index 1a446b842..696fdf88f 100644
--- a/module/plugins/accounts/PremiumizeMe.py
+++ b/module/plugins/accounts/PremiumizeMe.py
@@ -1,44 +1,44 @@
-from module.plugins.Account import Account
-
-from module.common.json_layer import json_loads
-
-class PremiumizeMe(Account):
- __name__ = "PremiumizeMe"
- __version__ = "0.11"
- __type__ = "account"
- __description__ = """Premiumize.Me account plugin"""
-
- __author_name__ = ("Florian Franzen")
- __author_mail__ = ("FlorianFranzen@gmail.com")
-
- def loadAccountInfo(self, user, req):
-
- # 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": max(0, status['result']['trafficleft_bytes'] / 1024)}
-
- if status['result']['type'] == 'free':
- account_info['premium'] = False
-
- return account_info
-
- def login(self, user, data, req):
-
- # Get user data from premiumize.me
- status = self.getAccountStatus(user, req)
-
- # Check if user and password are valid
- if status['status'] != 200:
- self.wrongPassword()
-
-
- def getAccountStatus(self, user, req):
-
- # 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)
-
+from module.plugins.Account import Account
+
+from module.common.json_layer import json_loads
+
+class PremiumizeMe(Account):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """Premiumize.Me account plugin"""
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+
+ # 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": max(0, status['result']['trafficleft_bytes'] / 1024)}
+
+ if status['result']['type'] == 'free':
+ account_info['premium'] = False
+
+ return account_info
+
+ def login(self, user, data, req):
+
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+
+ # Check if user and password are valid
+ if status['status'] != 200:
+ self.wrongPassword()
+
+
+ def getAccountStatus(self, user, req):
+
+ # 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)
+