diff options
author | 2015-10-02 10:09:26 +0200 | |
---|---|---|
committer | 2015-10-02 10:09:26 +0200 | |
commit | 3a08656c5665f4b8db98744fb323e64b8630e084 (patch) | |
tree | 28f9f62ffc57888b76ca32540dbf5af3a4cfc8d0 /module/plugins/accounts/PremiumizeMe.py | |
parent | Merge pull request #1 from pyload/stable (diff) | |
parent | [Account] Improve parse_traffic method + code cosmetics (diff) | |
download | pyload-3a08656c5665f4b8db98744fb323e64b8630e084.tar.xz |
Merge pull request #2 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/accounts/PremiumizeMe.py')
-rw-r--r-- | module/plugins/accounts/PremiumizeMe.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index df3b5db51..2dc9b8a71 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -7,15 +7,36 @@ from module.plugins.internal.Account import Account class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.19" + __version__ = "0.21" __status__ = "testing" + __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), + ("mh_list" , "str" , "Hoster list (comma separated)", "" ), + ("mh_interval", "int" , "Reload interval in minutes" , 60 )] + __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def parse_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + #: Get supported hosters list from premiumize.me using the + #: json API v1 (see https://secure.premiumize.me/?show=api) + answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 + get={'method' : "hosterlist", + 'params[login]': user, + 'params[pass]' : password}) + data = json_loads(answer) + + #: If account is not valid thera are no hosters available + if data['status'] != 200: + return [] + + #: Extract hosters from json file + return data['result']['hosterlist'] + + + def grab_info(self, user, password, data): #: Get user data from premiumize.me status = self.get_account_status(user, password) self.log_debug(status) @@ -30,13 +51,13 @@ class PremiumizeMe(Account): return account_info - def login(self, user, password, data, req): + def signin(self, user, password, data): #: Get user data from premiumize.me status = self.get_account_status(user, password) #: Check if user and password are valid if status['status'] != 200: - self.login_fail() + self.fail_login() def get_account_status(self, user, password): |