From 88f34841c319c1c67469a361350b0482d4952e11 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 14 Aug 2012 21:48:19 +0200 Subject: closed #653, #654, fix cbh --- module/plugins/hooks/CaptchaBrotherhood.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index d3c1dd043..a22a5ee1d 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -44,7 +44,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" - __version__ = "0.02" + __version__ = "0.03" __description__ = """send captchas to CaptchaBrotherhood.com""" __config__ = [("activated", "bool", "Activated", False), ("username", "str", "Username", ""), @@ -73,9 +73,14 @@ class CaptchaBrotherhood(Hook): def submit(self, captcha, captchaType="file", match=None): try: img = Image.open(captcha) - self.logDebug("CAPTCHA IMAGE", img, img.format) output = StringIO.StringIO() - img.save(output, "JPEG") + self.logDebug("CAPTCHA IMAGE", img, img.format, img.mode) + if img.format in ("GIF", "JPEG"): + img.save(output, img.format) + else: + if img.mode != "RGB": + img = img.convert("RGB") + img.save(output, "JPEG") data = output.getvalue() output.close() except Exception, e: @@ -150,7 +155,7 @@ class CaptchaBrotherhood(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = self.get_api("complainCaptcha", ticket) + response = self.get_api("complainCaptcha", task.data['ticket']) def processCaptcha(self, task): c = task.captchaFile -- cgit v1.2.3