diff options
author | jansohn <jansohn@users.noreply.github.com> | 2015-10-02 10:09:26 +0200 |
---|---|---|
committer | jansohn <jansohn@users.noreply.github.com> | 2015-10-02 10:09:26 +0200 |
commit | 3a08656c5665f4b8db98744fb323e64b8630e084 (patch) | |
tree | 28f9f62ffc57888b76ca32540dbf5af3a4cfc8d0 /module/plugins/accounts/RapideoPl.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/RapideoPl.py')
-rw-r--r-- | module/plugins/accounts/RapideoPl.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 42d084bdb..fc17622b0 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -6,14 +6,19 @@ import time from module.common.json_layer import json_loads from module.plugins.internal.Account import Account +# from module.plugins.internal.MultiAccount import MultiAccount class RapideoPl(Account): __name__ = "RapideoPl" __type__ = "account" - __version__ = "0.03" + __version__ = "0.06" __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__ = "Rapideo.pl account plugin" __license__ = "GPLv3" __authors__ = [("goddie", "dev@rapideo.pl")] @@ -27,15 +32,19 @@ class RapideoPl(Account): 'loc' : "1" , 'info' : "1" } - _req = None - _usr = None - _pwd = None + def grab_hosters(self, user, password, data): + hostings = json_loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip()) + hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] + + self.log_debug(hostings_domains) + + return hostings_domains - def parse_info(self, name, req): - self._req = req + def grab_info(self, user, password, data): try: result = json_loads(self.run_auth_query()) + except Exception: #@TODO: return or let it be thrown? return @@ -54,27 +63,24 @@ class RapideoPl(Account): 'premium' : premium } - def login(self, user, password, data, req): - self._usr = user - self._pwd = hashlib.md5(password).hexdigest() - self._req = req + def signin(self, user, password, data): + data['usr'] = user + data['pwd'] = hashlib.md5(password).hexdigest() try: response = json_loads(self.run_auth_query()) + except Exception: - self.login_fail() + self.fail_login() if "errno" in response.keys(): - self.login_fail() - - data['usr'] = self._usr - data['pwd'] = self._pwd + self.fail_login() def create_auth_query(self): query = self.API_QUERY - query['username'] = self._usr - query['password'] = self._pwd + query['username'] = self.info['data']['usr'] + query['password'] = self.info['data']['pwd'] return query |