diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-04-11 12:18:22 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-11 12:18:22 +0200 |
commit | d68938a9a7fbfb079b0a6de469de766b5892d769 (patch) | |
tree | 443b21cc277126fa44486bc940f8aa521f92564d | |
parent | Use wait to set time in SimpleHoster plugins (diff) | |
download | pyload-d68938a9a7fbfb079b0a6de469de766b5892d769.tar.xz |
Remove bad whitespaces
Merges vuolter/pyload@e4b2562
49 files changed, 134 insertions, 139 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index 5619cb0a1..e75fc0ecb 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ @@ -76,7 +76,7 @@ class Account(Base): def _login(self, user, data): # set timestamp for login self.timestamps[user] = time() - + req = self.getAccountRequest(user) try: self.login(user, data, req) diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index fc521d36c..4211aea4d 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -60,21 +60,21 @@ class AccountManager(): def getAccountPlugins(self): """ get all account instances""" - + plugins = [] for plugin in self.accounts.keys(): plugins.append(self.getAccountPlugin(plugin)) - + return plugins #---------------------------------------------------------------------- def loadAccounts(self): """loads all accounts available""" - + if not exists("accounts.conf"): f = open("accounts.conf", "wb") f.write("version: " + str(ACC_VERSION)) f.close() - + f = open("accounts.conf", "rb") content = f.readlines() version = content[0].split(":")[1].strip() if content else "" @@ -87,60 +87,57 @@ class AccountManager(): f.close() self.core.log.warning(_("Account settings deleted, due to new config format.")) return - - - + plugin = "" name = "" - + for line in content[1:]: line = line.strip() - + if not line: continue if line.startswith("#"): continue if line.startswith("version"): continue - + if line.endswith(":") and line.count(":") == 1: plugin = line[:-1] self.accounts[plugin] = {} - + elif line.startswith("@"): try: option = line[1:].split() self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) except: pass - + elif ":" in line: name, sep, pw = line.partition(":") self.accounts[plugin][name] = {"password": pw, "options": {}, "valid": True} #---------------------------------------------------------------------- def saveAccounts(self): """save all account information""" - + f = open("accounts.conf", "wb") f.write("version: " + str(ACC_VERSION) + "\n") - + for plugin, accounts in self.accounts.iteritems(): f.write("\n") f.write(plugin+":\n") - + for name,data in accounts.iteritems(): f.write("\n\t%s:%s\n" % (name,data["password"]) ) if data["options"]: for option, values in data["options"].iteritems(): f.write("\t@%s %s\n" % (option, " ".join(values))) - + f.close() chmod(f.name, 0600) - - + #---------------------------------------------------------------------- def initAccountPlugins(self): """init names""" for name in self.core.pluginManager.getAccountPlugins(): self.accounts[name] = {} - + @lock def updateAccount(self, plugin , user, password=None, options={}): """add or update account""" @@ -148,14 +145,14 @@ class AccountManager(): p = self.getAccountPlugin(plugin) updated = p.updateAccounts(user, password, options) #since accounts is a ref in plugin self.accounts doesnt need to be updated here - + self.saveAccounts() if updated: p.scheduleRefresh(user, force=False) - + @lock def removeAccount(self, plugin, user): """remove account""" - + if plugin in self.accounts: p = self.getAccountPlugin(plugin) p.removeAccount(user) @@ -169,7 +166,7 @@ class AccountManager(): if refresh: self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) force = False - + for p in self.accounts.keys(): if self.accounts[p]: p = self.getAccountPlugin(p) @@ -179,7 +176,7 @@ class AccountManager(): e = AccountUpdateEvent() self.core.pullManager.addEvent(e) return data - + def sendChange(self): e = AccountUpdateEvent() self.core.pullManager.addEvent(e) diff --git a/module/plugins/Container.py b/module/plugins/Container.py index fe6e04ca4..685ceac20 100644 --- a/module/plugins/Container.py +++ b/module/plugins/Container.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ @@ -38,19 +38,19 @@ class Container(Crypter): self.setup() self.thread = thread - + self.loadToDisk() self.decrypt(self.pyfile) self.deleteTmp() - + self.createPackages() - + def loadToDisk(self): """loads container to disk if its stored remotely and overwrite url, or check existent on several places at disk""" - + if self.pyfile.url.startswith("http"): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) @@ -58,7 +58,7 @@ class Container(Crypter): f = open(self.pyfile.url, "wb" ) f.write(content) f.close() - + else: self.pyfile.name = basename(self.pyfile.url) if not exists(self.pyfile.url): @@ -66,7 +66,7 @@ class Container(Crypter): self.pyfile.url = join(pypath, self.pyfile.url) else: self.fail(_("File not exists.")) - + def deleteTmp(self): if self.pyfile.name.startswith("tmp_"): diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 69f4918dc..b2e6528e9 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ @@ -27,19 +27,19 @@ class Crypter(Plugin): __description__ = """Base decrypter plugin""" __author_name__ = "mkaay" __author_mail__ = "mkaay@mkaay.de" - + def __init__(self, pyfile): Plugin.__init__(self, pyfile) - + #: Put all packages here. It's a list of tuples like: ( name, [list of links], folder ) self.packages = [] #: List of urls, pyLoad will generate packagenames self.urls = [] - + self.multiDL = True self.limitDL = 0 - + def preprocessing(self, thread): """prepare""" @@ -47,9 +47,9 @@ class Crypter(Plugin): self.thread = thread self.decrypt(self.pyfile) - + self.createPackages() - + def decrypt(self, pyfile): raise NotImplementedError @@ -59,9 +59,9 @@ class Crypter(Plugin): for pack in self.packages: self.log.debug("Parsed package %(name)s with %(len)d links" % { "name" : pack[0], "len" : len(pack[1]) } ) - + links = [x.decode("utf-8") for x in pack[1]] - + pid = self.core.api.addPackage(pack[0], links, self.pyfile.package().queue) if self.pyfile.package().password: diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 9858a0858..6f5abffed 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay @interface-version: 0.2 """ @@ -108,7 +108,7 @@ class Hook(Base): def __repr__(self): return "<Hook %s>" % self.__name__ - + def setup(self): """ more init stuff if needed """ pass @@ -116,11 +116,11 @@ class Hook(Base): def unload(self): """ called when hook was deactivated """ pass - + def isActivated(self): """ checks if hook is activated""" return self.config.getPlugin(self.__name__, "activated") - + #event methods - overwrite these if needed def coreReady(self): @@ -128,25 +128,25 @@ class Hook(Base): def coreExiting(self): pass - + def downloadPreparing(self, pyfile): pass - + def downloadFinished(self, pyfile): pass - + def downloadFailed(self, pyfile): pass - + def packageFinished(self, pypack): pass def beforeReconnecting(self, ip): pass - + def afterReconnecting(self, ip): pass - + def periodical(self): pass diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 0489c3d09..4979d383b 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 8ee1c49e5..584fcce49 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -263,7 +263,7 @@ class Plugin(Base): def setWait(self, seconds, reconnect=False): """Set a specific wait time later used with `wait` - + :param seconds: wait time in seconds :param reconnect: True if a reconnect would avoid wait time """ @@ -339,7 +339,7 @@ class Plugin(Base): :param result_type: 'textual' if text is written on the captcha\ or 'positional' for captcha where the user have to click\ on a specific region on the captcha - + :return: result of decrypting """ @@ -528,7 +528,7 @@ class Plugin(Base): def checkDownload(self, rules, api_size=0, max_size=50000, delete=True, read_size=0): """ checks the content of the last downloaded file, re match is saved to `lastCheck` - + :param rules: dict with names and rules to match (compiled regexp or strings) :param api_size: expected file size :param max_size: if the file is larger then it wont be checked diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py index 6660ea302..e976b2c4a 100644 --- a/module/plugins/PluginManager.py +++ b/module/plugins/PluginManager.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay, RaNaN """ @@ -79,11 +79,11 @@ class PluginManager: """ returns dict with information home contains parsed plugins from module. - + { name : {path, version, config, (pattern, re), (plugin, class)} } - + """ plugins = {} if home: diff --git a/module/plugins/ReCaptcha.py b/module/plugins/ReCaptcha.py index e8b86195a..1ced5e18d 100644 --- a/module/plugins/ReCaptcha.py +++ b/module/plugins/ReCaptcha.py @@ -3,17 +3,17 @@ import re class ReCaptcha(): def __init__(self, plugin): self.plugin = plugin - + def challenge(self, id): js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k":id}, cookies=True) - + try: challenge = re.search("challenge : '(.*?)',", js).group(1) server = re.search("server : '(.*?)',", js).group(1) except: self.plugin.fail("recaptcha error") result = self.result(server,challenge) - + return challenge, result def result(self, server, challenge): diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py index d9330158a..9aaa08a12 100644 --- a/module/plugins/accounts/BayfilesCom.py +++ b/module/plugins/accounts/BayfilesCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 188ee74e9..fc0b98793 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index d75c9b729..427f5c34d 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index b14031779..16ce674e2 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index 223d3fcf6..3fb0d7f50 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index 9b9173315..ba6105e6e 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 15e1d90be..f2becb8c9 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 42b45625c..304f20040 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 439e4cd81..266935a9f 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index e8c8c5bd6..869705313 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index 7188e6758..f6988542f 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay, JoKoT3 """ diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 505b57752..cd2fd575c 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index d71fba070..3d2b52470 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 356ed23c8..5a69a7f66 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 8fcd0c95a..c008a0db3 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index bc41ac5e1..17d7f0e08 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 6ab1492c2..f188fc580 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index e371a89b1..529e2131f 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index 73615b13a..19ffaf1e5 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index b6058115b..02f31c544 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 665c6346f..f0395c13a 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/accounts/WarserverCz.py b/module/plugins/accounts/WarserverCz.py index 62c7e19fa..a5acf5e52 100644 --- a/module/plugins/accounts/WarserverCz.py +++ b/module/plugins/accounts/WarserverCz.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg """ diff --git a/module/plugins/captcha/GigasizeCom.py b/module/plugins/captcha/GigasizeCom.py index d31742eb5..adf97c080 100644 --- a/module/plugins/captcha/GigasizeCom.py +++ b/module/plugins/captcha/GigasizeCom.py @@ -4,7 +4,7 @@ from captcha import OCR class GigasizeCom(OCR): def __init__(self): OCR.__init__(self) - + def get_captcha(self, image): self.load_image(image) self.threshold(2.8) @@ -15,5 +15,5 @@ if __name__ == '__main__': ocr = GigasizeCom() import urllib urllib.urlretrieve('http://www.gigasize.com/randomImage.php', "gigasize_tmp.jpg") - + print ocr.get_captcha('gigasize_tmp.jpg') diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index e3cdf5a45..df885044a 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -11,7 +11,7 @@ class LinksaveIn(OCR): def __init__(self): OCR.__init__(self) self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep - + def load_image(self, image): im = Image.open(image) frame_nr = 0 @@ -38,7 +38,7 @@ class LinksaveIn(OCR): self.image = new.copy() self.pixels = self.image.load() self.result_captcha = '' - + def get_bg(self): stat = {} cstat = {} @@ -46,15 +46,15 @@ class LinksaveIn(OCR): for bgpath in glob(self.data_dir+"bg/*.gif"): stat[bgpath] = 0 bg = Image.open(bgpath) - + bglut = bg.resize((256, 1)) bglut.putdata(range(256)) bglut = list(bglut.convert("RGB").getdata()) - + lut = img.resize((256, 1)) lut.putdata(range(256)) lut = list(lut.convert("RGB").getdata()) - + bgpix = bg.load() pix = img.load() for x in xrange(bg.size[0]): @@ -74,19 +74,19 @@ class LinksaveIn(OCR): bg = bgpath max_p = value return bg - + def substract_bg(self, bgpath): bg = Image.open(bgpath) img = self.image.convert("P") - + bglut = bg.resize((256, 1)) bglut.putdata(range(256)) bglut = list(bglut.convert("RGB").getdata()) - + lut = img.resize((256, 1)) lut.putdata(range(256)) lut = list(lut.convert("RGB").getdata()) - + bgpix = bg.load() pix = img.load() orgpix = self.image.load() @@ -96,7 +96,7 @@ class LinksaveIn(OCR): rgb_c = lut[pix[x, y]] 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() @@ -117,7 +117,7 @@ class LinksaveIn(OCR): pix[x, y] = (0,0,0) self.image = new self.pixels = self.image.load() - + def get_captcha(self, image): self.load_image(image) bg = self.get_bg() @@ -135,7 +135,7 @@ class LinksaveIn(OCR): self.image.save(ocr.data_dir+"letter%d.png" % n) self.run_tesser(True, True, False, False) final += self.result_captcha - + return final if __name__ == '__main__': @@ -143,5 +143,5 @@ if __name__ == '__main__': 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') diff --git a/module/plugins/captcha/NetloadIn.py b/module/plugins/captcha/NetloadIn.py index 7f2e6a8d1..b7ad9d310 100644 --- a/module/plugins/captcha/NetloadIn.py +++ b/module/plugins/captcha/NetloadIn.py @@ -11,9 +11,9 @@ class NetloadIn(OCR): self.clean(3) self.clean(3) self.run_tesser(True, True, False, False) - + self.result_captcha = self.result_captcha.replace(" ", "")[:4] # cut to 4 numbers - + return self.result_captcha if __name__ == '__main__': diff --git a/module/plugins/captcha/ShareonlineBiz.py b/module/plugins/captcha/ShareonlineBiz.py index b07fb9b0f..a759f80ce 100644 --- a/module/plugins/captcha/ShareonlineBiz.py +++ b/module/plugins/captcha/ShareonlineBiz.py @@ -21,10 +21,10 @@ from captcha import OCR class ShareonlineBiz(OCR): __name__ = "ShareonlineBiz" - + def __init__(self): OCR.__init__(self) - + def get_captcha(self, image): self.load_image(image) self.to_greyscale() @@ -35,7 +35,7 @@ class ShareonlineBiz(OCR): #self.derotate_by_average() letters = self.split_captcha_letters() - + final = "" for letter in letters: self.image = letter diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 66f093e40..3a854f5de 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -33,9 +33,9 @@ import JpegImagePlugin class OCR(object): - + __name__ = "OCR" - + def __init__(self): self.logger = logging.getLogger("log") @@ -53,7 +53,7 @@ class OCR(object): def run(self, command): """Run a command""" - + popen = subprocess.Popen(command, bufsize = -1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) popen.wait() output = popen.stdout.read() +" | "+ popen.stderr.read() @@ -63,8 +63,7 @@ class OCR(object): def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): #self.logger.debug("create tmp tif") - - + #tmp = tempfile.NamedTemporaryFile(suffix=".tif") tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") tmp.close() @@ -72,7 +71,7 @@ class OCR(object): #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") tmpTxt.close() - + self.logger.debug("save tiff") self.image.save(tmp.name, 'TIFF') @@ -80,7 +79,7 @@ class OCR(object): tessparams = [join(pypath,"tesseract","tesseract.exe")] else: tessparams = ['tesseract'] - + tessparams.extend( [abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")] ) if subset and (digits or lowercase or uppercase): @@ -98,7 +97,7 @@ class OCR(object): tessparams.append("nobatch") tessparams.append(abspath(tmpSub.name)) tmpSub.close() - + self.logger.debug("run tesseract") self.run(tessparams) self.logger.debug("read txt") @@ -117,7 +116,7 @@ class OCR(object): os.remove(tmpSub.name) except: pass - + def get_captcha(self, name): raise NotImplementedError diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index eb5bacab3..781e2be45 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -19,7 +19,7 @@ class CCF(Container): __author_mail__ = "Willnix@pyload.org" def decrypt(self, pyfile): - + infile = pyfile.url.replace("\n", "") opener = build_opener(MultipartPostHandler) @@ -32,7 +32,7 @@ class CCF(Container): location = download_folder #join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding())) if not exists(location): makedirs(location) - + tempdlc_name = join(location, "tmp_%s.dlc" % pyfile.name) tempdlc = open(tempdlc_name, "w") tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index 6baf9f55d..90ff40d20 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -20,22 +20,22 @@ class LinkList(Container): file_enc = codecs.lookup(self.getConfig("encoding")).name except: file_enc = "utf-8" - + print repr(pyfile.url) print pyfile.url - + file_name = fs_encode(pyfile.url) - + txt = codecs.open(file_name, 'r', file_enc) links = txt.readlines() curPack = "Parsed links from %s" % pyfile.name - + packages = {curPack:[],} - + for link in links: link = link.strip() if not link: continue - + if link.startswith(";"): continue if link.startswith("[") and link.endswith("]"): @@ -45,15 +45,15 @@ class LinkList(Container): continue packages[curPack].append(link) txt.close() - + # empty packages fix delete = [] - + for key,value in packages.iteritems(): if not value: delete.append(key) - + for key in delete: del packages[key] @@ -63,6 +63,6 @@ class LinkList(Container): txt.close() except: self.log.warning(_("LinkList could not be cleared.")) - + for name, links in packages.iteritems(): self.packages.append((name, links, name)) diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index 136024fa3..c9721533e 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -15,9 +15,8 @@ class RSDF(Container): __author_name__ = ("RaNaN", "spoob") __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") - def decrypt(self, pyfile): - + from Crypto.Cipher import AES infile = pyfile.url.replace("\n", "") diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 5a1662da3..002fd4cd7 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: RaNaN @interface-version: 0.2 """ diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index 0104ab7c9..41a20e5d1 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -11,7 +11,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: zoidberg Original idea by new.cze """ diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index 82c054902..38bcaf440 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: RaNaN @interface-version: 0.2 """ diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 1945df799..760c1a4df 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: RaNaN @author: jeix @interface-version: 0.2 diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index 687017a4b..99b0aafc6 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: and9000 """ diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 67be26b79..b1635a588 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: mkaay """ diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneToastNotify.py index a769d0c5e..a9772e766 100644 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ b/module/plugins/hooks/WindowsPhoneToastNotify.py @@ -32,7 +32,7 @@ class WindowsPhoneToastNotify(Hook): def setup(self): self.info = {} - + def getXmlData(self): myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " "<wp:Toast> <wp:Text1>Pyload Mobile</wp:Text1> <wp:Text2>Captcha waiting!</wp:Text2> " @@ -60,8 +60,8 @@ class WindowsPhoneToastNotify(Hook): if self.core.isClientConnected() and not self.getConfig("force"): return False - + if (time.time() - float(self.getStorage("LAST_NOTIFY", 0))) < self.getConf("pushTimeout"): return False - + self.doRequest() diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 2058d21d6..af9191a4d 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: jeix @author: mkaay """ diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index d100a6c66..b2393c60b 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -19,5 +19,5 @@ class MovReelCom(XFileSharingPro): DIRECT_LINK_PATTERN = r'<a href="(http://[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/.*)">Download Link</a>' #OVR_DOWNLOAD_LINK_PATTERN = "var file_link = '(.*)';" HOSTER_NAME = "movreel.com" - + getInfo = create_getInfo(MovReelCom) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index 43f0dd656..5a5422cef 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: jeix """ |