From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/captcha/LinksaveIn.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 8ce26fbac..383c4b906 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -1,15 +1,23 @@ # -*- coding: utf-8 -*- -from captcha import OCR -import Image -from os import sep -from os.path import dirname -from os.path import abspath +from PIL import Image from glob import glob +from os import sep +from os.path import abspath, dirname + +from module.plugins.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" + __version__ = "0.1" + __type__ = "ocr" + + __description__ = """Linksave.in ocr plugin""" + __author_name__ = "pyLoad Team" + __author_mail__ = "admin@pyload.org" + + def __init__(self): OCR.__init__(self) self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep @@ -140,10 +148,11 @@ class LinksaveIn(OCR): return final + if __name__ == '__main__': import urllib + ocr = LinksaveIn() testurl = "http://linksave.in/captcha/cap.php?hsh=2229185&code=ZzHdhl3UffV3lXTH5U4b7nShXj%2Bwma1vyoNBcbc6lcc%3D" urllib.urlretrieve(testurl, ocr.data_dir+"captcha.gif") - print ocr.get_captcha(ocr.data_dir+'captcha.gif') -- cgit v1.2.3 From a88d976e387c36eb44461c627dee6b3cae4e5cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:18:44 +0200 Subject: Fix captcha import bug introduced in 48c0c42fd6faffc56432d5f037cd575979f180cc --- 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 383c4b906..12879db1f 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -5,7 +5,7 @@ from glob import glob from os import sep from os.path import abspath, dirname -from module.plugins.OCR import OCR +from captcha import OCR class LinksaveIn(OCR): -- cgit v1.2.3 From cedfbde86de423b8f004299af9f8ab60606cb790 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:26:43 +0200 Subject: Remove testcodes in captcha plugins --- module/plugins/captcha/LinksaveIn.py | 9 --------- 1 file changed, 9 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 12879db1f..da36cf552 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -147,12 +147,3 @@ class LinksaveIn(OCR): final += self.result_captcha return final - - -if __name__ == '__main__': - import urllib - - ocr = LinksaveIn() - testurl = "http://linksave.in/captcha/cap.php?hsh=2229185&code=ZzHdhl3UffV3lXTH5U4b7nShXj%2Bwma1vyoNBcbc6lcc%3D" - urllib.urlretrieve(testurl, ocr.data_dir+"captcha.gif") - print ocr.get_captcha(ocr.data_dir+'captcha.gif') -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor 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 da36cf552..dd5ac7b98 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -5,13 +5,13 @@ from glob import glob from os import sep from os.path import abspath, dirname -from captcha import OCR +from module.plugins.captcha import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" - __version__ = "0.1" __type__ = "ocr" + __version__ = "0.1" __description__ = """Linksave.in ocr plugin""" __author_name__ = "pyLoad Team" -- cgit v1.2.3 From a74f7bb16a1419c6b8c37fc0d916c9f63a296235 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 2 Oct 2014 21:25:25 +0200 Subject: Fix captcha import of OCR class --- 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 dd5ac7b98..d915b7628 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -5,7 +5,7 @@ from glob import glob from os import sep from os.path import abspath, dirname -from module.plugins.captcha import OCR +from module.plugins.captcha.captcha import OCR class LinksaveIn(OCR): -- cgit v1.2.3 From 2a5ff9ce8b025336cccdd7dde1260a7255efc683 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 17:06:22 +0200 Subject: Fix pillow import header --- module/plugins/captcha/LinksaveIn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index d915b7628..069c8090d 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- -from PIL import Image +try: + from PIL import Image +except ImportError: + import Image + from glob import glob from os import sep from os.path import abspath, dirname -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/captcha/LinksaveIn.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 069c8090d..1414e06ac 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -18,8 +18,7 @@ class LinksaveIn(OCR): __version__ = "0.1" __description__ = """Linksave.in ocr plugin""" - __author_name__ = "pyLoad Team" - __author_mail__ = "admin@pyload.org" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- 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 1414e06ac..e8487c387 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -18,6 +18,7 @@ class LinksaveIn(OCR): __version__ = "0.1" __description__ = """Linksave.in ocr plugin""" + __license__ = "GPLv3" __authors__ = [("pyLoad Team", "admin@pyload.org")] -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/captcha/LinksaveIn.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index e8487c387..6535dd11f 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -26,6 +26,7 @@ class LinksaveIn(OCR): OCR.__init__(self) self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep + def load_image(self, image): im = Image.open(image) frame_nr = 0 @@ -53,6 +54,7 @@ class LinksaveIn(OCR): self.pixels = self.image.load() self.result_captcha = '' + def get_bg(self): stat = {} cstat = {} @@ -89,6 +91,7 @@ class LinksaveIn(OCR): max_p = value return bg + def substract_bg(self, bgpath): bg = Image.open(bgpath) img = self.image.convert("P") @@ -111,6 +114,7 @@ class LinksaveIn(OCR): if rgb_c == rgb_bg: orgpix[x, y] = (255,255,255) + def eval_black_white(self): new = Image.new("RGB", (140, 75)) pix = new.load() @@ -132,6 +136,7 @@ class LinksaveIn(OCR): self.image = new self.pixels = self.image.load() + def get_captcha(self, image): self.load_image(image) bg = self.get_bg() -- cgit v1.2.3 From 302616d94f76ab8794b58d3d54b780cc58e86b06 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 04:58:47 +0100 Subject: Code cosmetics: items() -> iteritems() --- 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 6535dd11f..b210ab071 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.items(): + for bgpath, value in stat.iteritems(): if max_p < value: bg = bgpath max_p = value -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/captcha/LinksaveIn.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/captcha/LinksaveIn.py') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index b210ab071..41673d8a6 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -13,13 +13,13 @@ from module.plugins.captcha.captcha import OCR class LinksaveIn(OCR): - __name__ = "LinksaveIn" - __type__ = "ocr" + __name__ = "LinksaveIn" + __type__ = "ocr" __version__ = "0.1" __description__ = """Linksave.in ocr plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): -- cgit v1.2.3 From 6151e81fa0b325dffda3da4228d5821e73db3ef3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Dec 2014 01:19:46 +0100 Subject: Fix __version__ format in some plugins --- 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 41673d8a6..56cbd58a0 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -15,7 +15,7 @@ from module.plugins.captcha.captcha import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.1" + __version__ = "0.10" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" -- cgit v1.2.3