From 0e1ef9bc01579328e17e79416fa3c1c7b77adcc8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 06:08:01 +0200 Subject: Update everything --- module/plugins/hooks/ExpertDecoders.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index ccd48f664..105abca79 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -9,13 +9,13 @@ from base64 import b64encode from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook, threaded +from module.plugins.internal.Hook import Hook, threaded class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] -- cgit v1.2.3 From f4b893e5ee24769584a2da1866c665489f7019ec Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 06:56:13 +0200 Subject: Hook plugin code cosmetics --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 105abca79..8a2a836aa 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -72,7 +72,7 @@ class ExpertDecoders(Hook): task.setResult(result) - def newCaptchaTask(self, task): + def captcha_task(self, task): if not task.isTextual(): return False -- cgit v1.2.3 From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 8a2a836aa..13289f8d1 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -91,7 +91,7 @@ class ExpertDecoders(Hook): self.logInfo(_("Your ExpertDecoders Account has not enough credits")) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if "ticket" in task.data: try: -- cgit v1.2.3 From c1764e2fea0bb05164c83a876e8cd58b97f58f25 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Jun 2015 17:31:38 +0200 Subject: Update all --- module/plugins/hooks/ExpertDecoders.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 13289f8d1..af5f2cfcd 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -8,7 +8,7 @@ import uuid from base64 import b64encode from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getURL, getRequest +from module.network.RequestFactory import getRequest from module.plugins.internal.Hook import Hook, threaded @@ -36,7 +36,7 @@ class ExpertDecoders(Hook): def getCredits(self): - res = getURL(self.API_URL, post={"key": self.getConfig('passkey'), "action": "balance"}) + res = self.load(self.API_URL, post={"key": self.getConfig('passkey'), "action": "balance"}) if res.isdigit(): self.logInfo(_("%s credits left") % res) @@ -60,11 +60,12 @@ class ExpertDecoders(Hook): req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: - result = req.load(self.API_URL, - post={'action' : "upload", + result = self.load(self.API_URL, + post={'action' : "upload", 'key' : self.getConfig('passkey'), 'file' : b64encode(data), - 'gen_task_id': ticket}) + 'gen_task_id': ticket}, + req=req) finally: req.close() @@ -95,7 +96,7 @@ class ExpertDecoders(Hook): if "ticket" in task.data: try: - res = getURL(self.API_URL, + res = self.load(self.API_URL, post={'action': "refund", 'key': self.getConfig('passkey'), 'gen_task_id': task.data['ticket']}) self.logInfo(_("Request refund"), res) -- cgit v1.2.3 From e4fb45b22d36595839e8f638a3f0a4669dba3e8d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 21 Jun 2015 08:50:26 +0200 Subject: Spare code cosmetics (4) --- module/plugins/hooks/ExpertDecoders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index af5f2cfcd..63cee2379 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -17,8 +17,8 @@ class ExpertDecoders(Hook): __type__ = "hook" __version__ = "0.05" - __config__ = [("force", "bool", "Force CT even if client is connected", False), - ("passkey", "password", "Access key", "")] + __config__ = [("passkey" , "password", "Access key" , "" ), + ("check_client", "bool" , "Don't use if client is connected", True)] __description__ = """Send captchas to expertdecoders.com""" __license__ = "GPLv3" @@ -80,7 +80,7 @@ class ExpertDecoders(Hook): if not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig('force'): + if self.core.isClientConnected() and self.getConfig('check_client'): return False if self.getCredits() > 0: -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/hooks/ExpertDecoders.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 63cee2379..6ec1f8bf1 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -15,7 +15,7 @@ from module.plugins.internal.Hook import Hook, threaded class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("passkey" , "password", "Access key" , "" ), ("check_client", "bool" , "Don't use if client is connected", True)] @@ -35,20 +35,20 @@ class ExpertDecoders(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def getCredits(self): - res = self.load(self.API_URL, post={"key": self.getConfig('passkey'), "action": "balance"}) + def get_credits(self): + res = self.load(self.API_URL, post={"key": self.get_config('passkey'), "action": "balance"}) if res.isdigit(): - self.logInfo(_("%s credits left") % res) + self.log_info(_("%s credits left") % res) self.info['credits'] = credits = int(res) return credits else: - self.logError(res) + self.log_error(res) return 0 @threaded - def _processCaptcha(self, task): + def _process_captcha(self, task): task.data['ticket'] = ticket = uuid.uuid4() result = None @@ -56,20 +56,20 @@ class ExpertDecoders(Hook): data = f.read() req = getRequest() - #raise timeout threshold + # raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: result = self.load(self.API_URL, post={'action' : "upload", - 'key' : self.getConfig('passkey'), + 'key' : self.get_config('passkey'), 'file' : b64encode(data), 'gen_task_id': ticket}, req=req) finally: req.close() - self.logDebug("Result %s : %s" % (ticket, result)) + self.log_debug("Result %s : %s" % (ticket, result)) task.setResult(result) @@ -77,19 +77,19 @@ class ExpertDecoders(Hook): if not task.isTextual(): return False - if not self.getConfig('passkey'): + if not self.get_config('passkey'): return False - if self.core.isClientConnected() and self.getConfig('check_client'): + if self.core.isClientConnected() and self.get_config('check_client'): return False - if self.getCredits() > 0: + if self.get_credits() > 0: task.handler.append(self) task.setWaiting(100) - self._processCaptcha(task) + self._process_captcha(task) else: - self.logInfo(_("Your ExpertDecoders Account has not enough credits")) + self.log_info(_("Your ExpertDecoders Account has not enough credits")) def captcha_invalid(self, task): @@ -97,8 +97,8 @@ class ExpertDecoders(Hook): try: res = self.load(self.API_URL, - post={'action': "refund", 'key': self.getConfig('passkey'), 'gen_task_id': task.data['ticket']}) - self.logInfo(_("Request refund"), res) + post={'action': "refund", 'key': self.get_config('passkey'), 'gen_task_id': task.data['ticket']}) + self.log_info(_("Request refund"), res) except BadHeader, e: - self.logError(_("Could not send refund request"), e) + self.log_error(_("Could not send refund request"), e) -- cgit v1.2.3 From 9e5d813d7721e351ac02ba72bdc473a7d77ba6b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Jul 2015 20:04:36 +0200 Subject: Code cosmetics --- module/plugins/hooks/ExpertDecoders.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 6ec1f8bf1..919445db8 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -8,7 +8,7 @@ import uuid from base64 import b64encode from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getRequest +from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Hook import Hook, threaded @@ -55,7 +55,7 @@ class ExpertDecoders(Hook): with open(task.captchaFile, 'rb') as f: data = f.read() - req = getRequest() + req = get_request() # raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) -- cgit v1.2.3 From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 919445db8..17890f691 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -56,7 +56,7 @@ class ExpertDecoders(Hook): data = f.read() req = get_request() - # raise timeout threshold + #: Raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: -- cgit v1.2.3 From 502517f37c7540b0bddb092e69386d9d6f08800c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 09:42:34 +0200 Subject: Fix addons --- module/plugins/hooks/ExpertDecoders.py | 6 ------ 1 file changed, 6 deletions(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 17890f691..baf880644 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -26,15 +26,9 @@ class ExpertDecoders(Hook): ("zoidberg", "zoidberg@mujmail.cz")] - interval = 0 #@TODO: Remove in 0.4.10 - API_URL = "http://www.fasttypers.org/imagepost.ashx" - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def get_credits(self): res = self.load(self.API_URL, post={"key": self.get_config('passkey'), "action": "balance"}) -- cgit v1.2.3 From ff9383bfe06d14d23bc0ed6af79aa8967965d078 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 10:59:52 +0200 Subject: Code cosmetics (3) --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index baf880644..ac1b223df 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -30,7 +30,7 @@ class ExpertDecoders(Hook): def get_credits(self): - res = self.load(self.API_URL, post={"key": self.get_config('passkey'), "action": "balance"}) + res = self.load(self.API_URL, post={'key': self.get_config('passkey'), 'action': "balance"}) if res.isdigit(): self.log_info(_("%s credits left") % res) -- cgit v1.2.3 From 56389e28ba5d2f5658278bc7f486d73be747f135 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 11:44:49 +0200 Subject: Rename self.core to self.pyload (plugins only) --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index ac1b223df..7b1ae15b1 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -74,7 +74,7 @@ class ExpertDecoders(Hook): if not self.get_config('passkey'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 0: -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/hooks/ExpertDecoders.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 7b1ae15b1..eb62ef796 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -16,6 +16,7 @@ class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" __version__ = "0.06" + __status__ = "stable" __config__ = [("passkey" , "password", "Access key" , "" ), ("check_client", "bool" , "Don't use if client is connected", True)] -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/hooks/ExpertDecoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/ExpertDecoders.py') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index eb62ef796..630382f2d 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -16,7 +16,7 @@ class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" __version__ = "0.06" - __status__ = "stable" + __status__ = "testing" __config__ = [("passkey" , "password", "Access key" , "" ), ("check_client", "bool" , "Don't use if client is connected", True)] -- cgit v1.2.3