From 7dc0b955b6e3d4448c173447c700717e8cdbbe95 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Jun 2015 19:43:37 +0200 Subject: Move OCR to internal plugin folder --- module/plugins/captcha/LinksaveIn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 95b107977..f5cfbc97b 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -8,13 +8,13 @@ except ImportError: import glob import os -from module.plugins.captcha.OCR import OCR +from module.plugins.internal.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 9305859b64a2f0aef3f27fb7e5b75caa0cb836a6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 19:24:49 +0200 Subject: Spare code cosmetics (3) --- module/plugins/captcha/LinksaveIn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index f5cfbc97b..7aeffbe79 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -31,7 +31,7 @@ class LinksaveIn(OCR): frame_nr = 0 lut = im.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) new = Image.new("RGB", im.size) @@ -63,11 +63,11 @@ class LinksaveIn(OCR): bg = Image.open(bgpath) bglut = bg.resize((256, 1)) - bglut.putdata(range(256)) + bglut.putdata(xrange(256)) bglut = list(bglut.convert("RGB").getdata()) lut = img.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) bgpix = bg.load() @@ -96,11 +96,11 @@ class LinksaveIn(OCR): img = self.image.convert("P") bglut = bg.resize((256, 1)) - bglut.putdata(range(256)) + bglut.putdata(xrange(256)) bglut = list(bglut.convert("RGB").getdata()) lut = img.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) bgpix = bg.load() -- 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/captcha/LinksaveIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 7aeffbe79..cf00acf15 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -14,7 +14,7 @@ from module.plugins.internal.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" -- 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/captcha/LinksaveIn.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index cf00acf15..a9fe2d630 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -2,6 +2,7 @@ try: from PIL import Image + except ImportError: import Image -- 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/captcha/LinksaveIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index a9fe2d630..f263f4588 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -52,7 +52,7 @@ class LinksaveIn(OCR): new.save(self.data_dir+"unblacked.png") self.image = new.copy() self.pixels = self.image.load() - self.result_captcha = '' + self.result_captcha = "" def get_bg(self): -- cgit v1.2.3 From 33e2b36605e41962a2e8eee304a7f3d29690ffa8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 13:42:29 +0200 Subject: [OCR] Fix __init__ (2) --- module/plugins/captcha/LinksaveIn.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index f263f4588..23944369b 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -15,15 +15,14 @@ from module.plugins.internal.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.13" + __version__ = "0.14" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" __authors__ = [("pyLoad Team", "admin@pyload.org")] - def __init__(self): - OCR.__init__(self) + def init(self): self.data_dir = os.path.dirname(os.path.abspath(__file__)) + os.sep + "LinksaveIn" + os.sep -- 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/captcha/LinksaveIn.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 23944369b..68704f21d 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -16,6 +16,7 @@ class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" __version__ = "0.14" + __status__ = "stable" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 6af9b38a8d5d49355b85aef6ddd003605d6bba05 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Jul 2015 23:44:45 +0200 Subject: Improve Captcha --- module/plugins/captcha/LinksaveIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 68704f21d..0a4731375 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -137,7 +137,7 @@ class LinksaveIn(OCR): self.pixels = self.image.load() - def get_captcha(self, image): + def recognize(self, image): self.load_image(image) bg = self.get_bg() self.substract_bg(bg) -- 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/captcha/LinksaveIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 0a4731375..de51a09f3 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -16,7 +16,7 @@ class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" __version__ = "0.14" - __status__ = "stable" + __status__ = "testing" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/captcha/LinksaveIn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index de51a09f3..ab9f54068 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -81,7 +81,7 @@ class LinksaveIn(OCR): cstat[rgb_c] += 1 except Exception: cstat[rgb_c] = 1 - if rgb_bg == rgb_c: + if rgb_bg is rgb_c: stat[bgpath] += 1 max_p = 0 bg = "" @@ -111,7 +111,7 @@ class LinksaveIn(OCR): for y in xrange(bg.size[1]): rgb_bg = bglut[bgpix[x, y]] rgb_c = lut[pix[x, y]] - if rgb_c == rgb_bg: + if rgb_c is rgb_bg: orgpix[x, y] = (255, 255, 255) -- cgit v1.2.3 From 952001324e1faf584b1adcb01c4a0406a3722932 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 09:42:49 +0200 Subject: =?UTF-8?q?Don't=20user=20dictionary=E2=80=99s=20iterator=20method?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/plugins/captcha/LinksaveIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index ab9f54068..4d2e2bc34 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -85,7 +85,7 @@ class LinksaveIn(OCR): stat[bgpath] += 1 max_p = 0 bg = "" - for bgpath, value in stat.iteritems(): + for bgpath, value in stat.items(): if max_p < value: bg = bgpath max_p = value -- cgit v1.2.3