summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/CaptchaBrotherhood.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-14 21:48:19 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-14 21:48:19 +0200
commit88f34841c319c1c67469a361350b0482d4952e11 (patch)
tree029ddc70f471abf7092672eacadf000f8553ea34 /module/plugins/hooks/CaptchaBrotherhood.py
parentshare-online.biz error handling - should fix #649 (diff)
downloadpyload-88f34841c319c1c67469a361350b0482d4952e11.tar.xz
closed #653, #654, fix cbh
Diffstat (limited to 'module/plugins/hooks/CaptchaBrotherhood.py')
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py13
1 files changed, 9 insertions, 4 deletions
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