From 97d25752691aa561c29a91166fdd30302bef2db2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 21 Sep 2015 00:54:03 +0200 Subject: [Account] parse_info -> grab_info --- module/plugins/accounts/ZeveraCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/ZeveraCom.py') diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 4138ba3cc..2b41fb343 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -33,7 +33,7 @@ class ZeveraCom(Account): self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") - def parse_info(self, user, password, data, req): + def grab_info(self, user, password, data, req): validuntil = None trafficleft = None premium = False @@ -53,7 +53,7 @@ class ZeveraCom(Account): self.password = password if self.api_response(req) == "No trafic": - self.login_fail() + self.fail_login() def api_response(self, req, just_header=False, **kwargs): -- cgit v1.2.3 From fb45ec44220201268f99b747831df717fa7a83f8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 21 Sep 2015 16:31:48 +0200 Subject: [Account] Fix __version__ --- module/plugins/accounts/ZeveraCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/ZeveraCom.py') diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 2b41fb343..ac057b76a 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __description__ = """Zevera.com account plugin""" -- cgit v1.2.3 From ec6e5dc7fcdcefee10e37d22473c9accae1104cf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 29 Sep 2015 20:05:07 +0200 Subject: Account class completely rewritten + plugins updated --- module/plugins/accounts/ZeveraCom.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'module/plugins/accounts/ZeveraCom.py') diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index ac057b76a..f85389cf8 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __status__ = "testing" __description__ = """Zevera.com account plugin""" @@ -17,7 +17,13 @@ class ZeveraCom(Account): ("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "zevera.com" + PLUGIN_DOMAIN = "zevera.com" + + + def grab_hosters(self, user, password, data): + html = self.api_response(user, password, cmd="gethosters") + return [x.strip() for x in html.split(",")] + def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 @@ -26,19 +32,19 @@ class ZeveraCom(Account): def init(self): - if not self.HOSTER_DOMAIN: - self.log_error(_("Missing HOSTER_DOMAIN")) + if not self.PLUGIN_DOMAIN: + self.log_error(_("Missing PLUGIN_DOMAIN")) if not hasattr(self, "API_URL"): - self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") + self.API_URL = "http://api.%s/jDownloader.ashx" % (self.PLUGIN_DOMAIN or "") - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = False - api = self.api_response(req) + api = self.api_response(user, password) if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!": validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) @@ -48,18 +54,15 @@ class ZeveraCom(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): - self.user = user - self.password = password - - if self.api_response(req) == "No trafic": + def signin(self, user, password, data): + if self.api_response(user, password) == "No trafic": self.fail_login() - def api_response(self, req, just_header=False, **kwargs): + def api_response(self, user, password=None, just_header=False, **kwargs): get_data = {'cmd' : "accountinfo", - 'login': self.user, - 'pass' : self.password} + 'login': user, + 'pass' : password} get_data.update(kwargs) -- cgit v1.2.3 From 3b3a4bd889286777ba6a590a1f74cf3edae36a72 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 30 Sep 2015 00:30:53 +0200 Subject: Add __config__ to MultiAccount (and XFSAccount) based plugins --- module/plugins/accounts/ZeveraCom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins/accounts/ZeveraCom.py') diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index f85389cf8..c94ad6db7 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -11,6 +11,10 @@ class ZeveraCom(Account): __version__ = "0.30" __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__ = """Zevera.com account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), @@ -25,7 +29,6 @@ class ZeveraCom(Account): return [x.strip() for x in html.split(",")] - def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 self.init() return super(ZeveraCom, self).__init__(manager, accounts) -- cgit v1.2.3