summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sleeper <devnull@localhost> 2010-04-12 22:25:31 +0200
committerGravatar Sleeper <devnull@localhost> 2010-04-12 22:25:31 +0200
commit497821fb18a93cdb356d5d1e6d3ae215b5cc1915 (patch)
treead3047947f8de323cb6e470924b3d34bcb456f5e
parentfix netload and shareonline, captcha subsets for better recognition (diff)
downloadpyload-497821fb18a93cdb356d5d1e6d3ae215b5cc1915.tar.xz
captcha fix
-rw-r--r--module/plugins/captcha/captcha.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index 452952533..eec63b54f 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -82,7 +82,7 @@ class OCR(object):
self.image.save(tmp)
self.result_captcha = self.run(['gocr', tmp.name]).replace("\n", "")
- def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True ):
+ def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True):
self.logger.debug("create tmp tif")
tmp = tempfile.NamedTemporaryFile(suffix=".tif")
self.logger.debug("create tmp txt")
@@ -90,7 +90,7 @@ class OCR(object):
self.logger.debug("save tiff")
self.image.save(tmp.name, 'TIFF')
- tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")
+ tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")]
if subset and (digits or lowercase or uppercase):
self.logger.debug("create temp subset config")
@@ -102,6 +102,7 @@ class OCR(object):
tmpSub.write("abcdefghijklmnopqrstuvwxyz")
if uppercase:
tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+ tmpSub.write("\n")
tessparams.append("nobatch")
tessparams.append(tmpSub.name)