summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/NoPremiumPl.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts/NoPremiumPl.py')
-rw-r--r--module/plugins/accounts/NoPremiumPl.py40
1 files changed, 23 insertions, 17 deletions
diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py
index e9dad7647..f8236c978 100644
--- a/module/plugins/accounts/NoPremiumPl.py
+++ b/module/plugins/accounts/NoPremiumPl.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 NoPremiumPl(Account):
__name__ = "NoPremiumPl"
__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__ = "NoPremium.pl account plugin"
__license__ = "GPLv3"
__authors__ = [("goddie", "dev@nopremium.pl")]
@@ -27,15 +32,19 @@ class NoPremiumPl(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.nopremium.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 NoPremiumPl(Account):
'premium' : premium }
- def login(self, user, password, data, req):
- self._usr = user
- self._pwd = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest()
- self._req = req
+ def signin(self, user, password, data):
+ data['usr'] = user
+ data['pwd'] = hashlib.sha1(hashlib.md5(password).hexdigest()).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