From a33d8062833d1bfec4777145cc484c1d6b9e141f Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 27 Aug 2010 17:07:33 +0200 Subject: some automatic fixes --- interfaces/pyLoadCli.py | 2 +- module/AccountManager.py | 14 +- module/FileDatabase.py | 2 +- module/FileList.py | 485 ------------------------------- module/debug.py | 2 +- module/gui/MainWindow.py | 2 +- module/gui/Queue.py | 4 +- module/network/XdccRequest.py | 2 +- module/plugins/accounts/FileserveCom.py | 2 +- module/plugins/accounts/HotfileCom.py | 2 +- module/plugins/captcha/captcha.py | 2 +- module/plugins/crypter/DDLMusicOrg.py | 2 +- module/plugins/crypter/HoerbuchIn.py | 2 +- module/plugins/crypter/SecuredIn.py | 302 +++++++++---------- module/plugins/hoster/DepositfilesCom.py | 4 +- module/plugins/hoster/FileserveCom.py | 58 ++-- module/plugins/hoster/FreakshareNet.py | 12 +- module/plugins/hoster/HotfileCom.py | 2 +- module/plugins/hoster/MegauploadCom.py | 4 +- module/plugins/hoster/MegavideoCom.py | 10 +- module/plugins/hoster/NetloadIn.py | 20 +- module/plugins/hoster/PornhostCom.py | 10 +- module/plugins/hoster/PornhubCom.py | 8 +- module/plugins/hoster/RapidshareCom.py | 10 +- module/plugins/hoster/RedtubeCom.py | 8 +- module/plugins/hoster/ShareCx.py | 16 +- module/plugins/hoster/ShragleCom.py | 10 +- module/plugins/hoster/UploadedTo.py | 2 +- module/plugins/hoster/YoupornCom.py | 10 +- module/plugins/hoster/YoutubeCom.py | 2 +- module/plugins/hoster/ZippyshareCom.py | 6 +- module/pyunrar.py | 2 +- module/remote/SecureXMLRPCServer.py | 2 +- module/web/ajax/views.py | 4 +- module/web/media/default/js/sprintf.js | 2 +- module/web/pyload/views.py | 22 +- pyLoadCore.py | 11 +- 37 files changed, 285 insertions(+), 775 deletions(-) delete mode 100644 module/FileList.py diff --git a/interfaces/pyLoadCli.py b/interfaces/pyLoadCli.py index fc8af9b86..8fdd75016 100755 --- a/interfaces/pyLoadCli.py +++ b/interfaces/pyLoadCli.py @@ -538,7 +538,7 @@ if __name__ == "__main__": if not server_url: if not username: username = raw_input(_("Username: ")) if not addr: addr = raw_input(_("address: ")) - if ssl == None: + if ssl is None: ssl = raw_input(_("Use SSL? ([y]/n): ")) if ssl == "y" or ssl == "": ssl = "s" diff --git a/module/AccountManager.py b/module/AccountManager.py index fc122e760..c6c14daf7 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -29,28 +29,28 @@ class AccountManager(): #---------------------------------------------------------------------- def __init__(self, core): """Constructor""" - + self.core = core - + self.accounts = {} # key = ( plugin ) self.plugins = {} - + self.initAccountPlugins() self.loadAccounts() - + self.saveAccounts() # save to add categories to conf - + #---------------------------------------------------------------------- def getAccountPlugin(self, plugin): """get account instance for plugin or None if anonymous""" if self.accounts.has_key(plugin): if not self.plugins.has_key(plugin): self.plugins[plugin] = self.core.pluginManager.getAccountPlugin(plugin)(self, self.accounts[plugin]) - + return self.plugins[plugin] else: return None - + def getAccountPlugins(self): """ get all account instances""" diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 291414b33..d7570486b 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -455,7 +455,7 @@ class FileHandler: def reCheckPackage(self, pid): """ recheck links in package """ - data = self.db.getPackageData() + data = self.db.getPackageData(pid) urls = [] diff --git a/module/FileList.py b/module/FileList.py deleted file mode 100644 index 6a43f7d54..000000000 --- a/module/FileList.py +++ /dev/null @@ -1,485 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: mkaay - @author: RaNaN - @version: v0.3.2 - @list-version: v4 -""" - -LIST_VERSION = 4 - -from operator import attrgetter -from operator import concat -from os.path import join -from threading import RLock -from time import sleep - -import cPickle -from module.DownloadThread import Status -from module.PullEvents import InsertEvent -from module.PullEvents import RemoveEvent -from module.PullEvents import UpdateEvent - -class NoSuchElementException(Exception): - pass - -class FileList(object): - def __init__(self, core): - self.core = core - self.lock = RLock() - self.download_folder = self.core.config["general"]["download_folder"] - self.collector = self.pyLoadCollector(self) - self.packager = self.pyLoadPackager(self) - - self.data = { - "version": LIST_VERSION, - "queue": [], - "packages": [], - "collector": [] - } - self.load() - - def load(self): - self.lock.acquire() - try: - pkl_file = open(join(self.core.configdir, "links.pkl"), "rb") - obj = cPickle.load(pkl_file) - except: - obj = False - if obj != False and obj["version"] == LIST_VERSION: - packages = [] - queue = [] - collector = [] - for n, pd in enumerate(obj["packages"]): - p = PyLoadPackage() - pd.get(p, self) - packages.append(p) - for pd in obj["queue"]: - p = PyLoadPackage() - pd.get(p, self) - queue.append(p) - for fd in obj["collector"]: - f = PyLoadFile("", self) - fd.get(f) - collector.append(f) - obj["packages"] = packages - obj["queue"] = queue - obj["collector"] = collector - self.data = obj - self.lock.release() - - if len(self.data["collector"]) > 0: - self.core.logger.info(_("Found %s links in linkcollector") % len(self.data["collector"])) - if len(self.data["packages"]) > 0: - self.core.logger.info(_("Found %s unqueued packages") % len(self.data["packages"])) - if len(self.data["queue"]) > 0: - self.core.logger.info(_("Added %s packages to queue") % len(self.data["queue"])) - - def save(self): - self.lock.acquire() - - pdata = { - "version": LIST_VERSION, - "queue": [], - "packages": [], - "collector": [] - } - - pdata["packages"] = [PyLoadPackageData().set(x) for x in self.data["packages"]] - pdata["queue"] = [PyLoadPackageData().set(x) for x in self.data["queue"]] - pdata["collector"] = [PyLoadFileData().set(x) for x in self.data["collector"]] - - output = open(join(self.core.configdir, "links.pkl"), "wb") - cPickle.dump(pdata, output, -1) - - self.lock.release() - - def queueEmpty(self): - return (self.data["queue"] == []) - - def getDownloadList(self, occ): - """ - for thread_list only, returns all elements that are suitable for downloadthread - """ - files = [] - files += [[x for x in p.files if x.status.type == None and x.plugin.__type__ == "container" and not x.active] for p in self.data["queue"] + self.data["packages"]] - files += [[x for x in p.files if (x.status.type == None or x.status.type == "reconnected") and not x.active and not x.plugin.__name__ in occ] for p in self.data["queue"]] - - return reduce(concat, files, []) - - def getAllFiles(self): - - return map(attrgetter("files"), self.data["queue"] + self.data["packages"]) - - def countDownloads(self): - """ simply return len of all files in all packages(which have no type) in queue and collector""" - return len(reduce(concat, [[x for x in p.files if x.status.type == None] for p in self.data["queue"] + self.data["packages"]], [])) - - def getFileInfo(self, id): - try: - n, pyfile = self.collector._getFileFromID(id) - except NoSuchElementException: - key, n, pyfile, pypack, pid = self.packager._getFileFromID(id) - info = {} - info["id"] = pyfile.id - info["url"] = pyfile.url - info["folder"] = pyfile.folder - info["filename"] = pyfile.status.filename - info["status_type"] = pyfile.status.type - info["status_url"] = pyfile.status.url - info["status_filename"] = pyfile.status.filename - info["status_error"] = pyfile.status.error - info["size"] = pyfile.status.size() - info["active"] = pyfile.active - info["plugin"] = pyfile.plugin.__name__ - try: - info["package"] = pypack.data["id"] - except: - pass - return info - - def continueAborted(self): - [[self.packager.resetFileStatus(x.id) for x in p.files if x.status.type == "aborted"] for p in self.data["queue"]] - - class pyLoadCollector(): - def __init__(collector, file_list): - collector.file_list = file_list - - def _getFileFromID(collector, id): - """ - returns PyLoadFile instance and position in collector with given id - """ - for n, pyfile in enumerate(collector.file_list.data["collector"]): - if pyfile.id == id: - return (n, pyfile) - raise NoSuchElementException() - - def _getFreeID(collector): - """ - returns a free id - """ - ids = [] - for pypack in (collector.file_list.data["packages"] + collector.file_list.data["queue"]): - for pyf in pypack.files: - ids.append(pyf.id) - ids += map(attrgetter("id"), collector.file_list.data["collector"]) - id = 1 - while id in ids: - id += 1 - return id - - def getFile(collector, id): - """ - returns PyLoadFile instance from given id - """ - return collector._getFileFromID(id)[1] - - def popFile(collector, id): - """ - returns PyLoadFile instance given id and remove it from the collector - """ - collector.file_list.lock.acquire() - try: - n, pyfile = collector._getFileFromID(id) - del collector.file_list.data["collector"][n] - collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) - except Exception, e: - raise Exception, e - else: - return pyfile - finally: - collector.file_list.lock.release() - - def addLink(collector, url): - """ - appends a new PyLoadFile instance to the end of the collector - """ - pyfile = PyLoadFile(url, collector.file_list) - pyfile.id = collector._getFreeID() - pyfile.folder = collector.file_list.download_folder - collector.file_list.lock.acquire() - collector.file_list.data["collector"].append(pyfile) - collector.file_list.lock.release() - collector.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, "collector")) - return pyfile.id - - def removeFile(collector, id): - """ - removes PyLoadFile instance with the given id from collector - """ - collector.popFile(id) - collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) - - def replaceFile(collector, newpyfile): - """ - replaces PyLoadFile instance with the given PyLoadFile instance at the given id - """ - collector.file_list.lock.acquire() - try: - n, pyfile = collector._getFileFromID(newpyfile.id) - collector.file_list.data["collector"][n] = newpyfile - collector.file_list.core.pullManager.addEvent(UpdateEvent("file", newpyfile.id, "collector")) - finally: - collector.file_list.lock.release() - - class pyLoadPackager(): - def __init__(packager, file_list): - packager.file_list = file_list - - def _getFreeID(packager): - """ - returns a free id - """ - ids = [pypack.data["id"] for pypack in packager.file_list.data["packages"] + packager.file_list.data["queue"]] - - id = 1 - while id in ids: - id += 1 - return id - - def _getPackageFromID(packager, id): - """ - returns PyLoadPackage instance and position with given id - """ - for n, pypack in enumerate(packager.file_list.data["packages"]): - if pypack.data["id"] == id: - return ("packages", n, pypack) - for n, pypack in enumerate(packager.file_list.data["queue"]): - if pypack.data["id"] == id: - return ("queue", n, pypack) - raise NoSuchElementException() - - def _getFileFromID(packager, id): - """ - returns PyLoadFile instance and position with given id - """ - for n, pypack in enumerate(packager.file_list.data["packages"]): - for pyfile in pypack.files: - if pyfile.id == id: - return ("packages", n, pyfile, pypack, pypack.data["id"]) - for n, pypack in enumerate(packager.file_list.data["queue"]): - for pyfile in pypack.files: - if pyfile.id == id: - return ("queue", n, pyfile, pypack, pypack.data["id"]) - raise NoSuchElementException() - - def addNewPackage(packager, package_name=None): - pypack = PyLoadPackage() - pypack.data["id"] = packager._getFreeID() - if package_name is not None: - pypack.data["package_name"] = package_name - packager.file_list.data["packages"].append(pypack) - packager.file_list.core.pullManager.addEvent(InsertEvent("pack", pypack.data["id"], -2, "packages")) - return pypack.data["id"] - - def removePackage(packager, id): - packager.file_list.lock.acquire() - try: - key, n, pypack = packager._getPackageFromID(id) - for pyfile in pypack.files: - pyfile.plugin.req.abort = True - sleep(0.1) - del packager.file_list.data[key][n] - packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, key)) - finally: - packager.file_list.lock.release() - - def removeFile(packager, id): - """ - removes PyLoadFile instance with the given id from package - """ - packager.file_list.lock.acquire() - try: - key, n, pyfile, pypack, pid = packager._getFileFromID(id) - pyfile.plugin.req.abort = True - sleep(0.1) - packager.removeFileFromPackage(id, pid) - if not pypack.files: - packager.removePackage(pid) - finally: - packager.file_list.lock.release() - - def pushPackage2Queue(packager, id): - packager.file_list.lock.acquire() - try: - key, n, pypack = packager._getPackageFromID(id) - if key == "packages": - del packager.file_list.data["packages"][n] - packager.file_list.data["queue"].append(pypack) - packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "packages")) - packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "queue")) - finally: - packager.file_list.lock.release() - - def pullOutPackage(packager, id): - packager.file_list.lock.acquire() - try: - key, n, pypack = packager._getPackageFromID(id) - if key == "queue": - del packager.file_list.data["queue"][n] - packager.file_list.data["packages"].append(pypack) - packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "queue")) - packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "packages")) - finally: - packager.file_list.lock.release() - - def setPackageData(packager, id, package_name=None, folder=None): - packager.file_list.lock.acquire() - try: - key, n, pypack = packager._getPackageFromID(id) - if package_name is not None: - pypack.data["package_name"] = package_name - if folder is not None: - pypack.data["folder"] = folder - packager.file_list.data[key][n] = pypack - packager.file_list.core.pullManager.addEvent(UpdateEvent("pack", id, key)) - finally: - packager.file_list.lock.release() - - def getPackageData(packager, id): - key, n, pypack = packager._getPackageFromID(id) - return pypack.data - - def getPackageFiles(packager, id): - key, n, pypack = packager._getPackageFromID(id) - ids = map(attrgetter("id"), pypack.files) - - return ids - - def addFileToPackage(packager, id, pyfile): - key, n, pypack = packager._getPackageFromID(id) - pyfile.package = pypack - pypack.files.append(pyfile) - packager.file_list.data[key][n] = pypack - packager.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, key)) - - def resetFileStatus(packager, fileid): - packager.file_list.lock.acquire() - try: - key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) - pyfile.init() - pyfile.status.type = None - packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) - finally: - packager.file_list.lock.release() - - def abortFile(packager, fileid): - packager.file_list.lock.acquire() - try: - key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) - pyfile.plugin.req.abort = True - packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) - finally: - packager.file_list.lock.release() - - def removeFileFromPackage(packager, id, pid): - key, n, pypack = packager._getPackageFromID(pid) - for k, pyfile in enumerate(pypack.files): - if id == pyfile.id: - del pypack.files[k] - packager.file_list.core.pullManager.addEvent(RemoveEvent("file", pyfile.id, key)) - if not pypack.files: - packager.removePackage(pid) - return True - raise NoSuchElementException() - -class PyLoadPackage(): - def __init__(self): - self.files = [] - self.data = { - "id": None, - "package_name": "new_package", - "folder": "" - } - -class PyLoadFile(): - def __init__(self, url, file_list): - self.id = None - self.url = url - self.folder = "" - self.file_list = file_list - self.core = file_list.core - self.package = None - self.filename = "n/a" - self.init() - - def init(self): - self.active = False - pluginClass = self.core.pluginManager.getPluginFromPattern(self.url) - self.plugin = pluginClass(self) - self.status = Status(self) - self.status.filename = self.url - - def init_download(self): - if self.core.config['proxy']['activated']: - self.plugin.req.add_proxy(self.core.config['proxy']['protocol'], self.core.config['proxy']['adress']) - -class PyLoadFileData(): - def __init__(self): - self.id = None - self.url = None - self.folder = None - self.pack_id = None - self.filename = None - self.status_type = None - self.status_url = None - - def set(self, pyfile): - self.id = pyfile.id - self.url = pyfile.url - self.folder = pyfile.folder - self.parsePackage(pyfile.package) - self.filename = pyfile.filename - self.status_type = pyfile.status.type - self.status_url = pyfile.status.url - self.status_filename = pyfile.status.filename - self.status_error = pyfile.status.error - - return self - - def get(self, pyfile): - pyfile.id = self.id - pyfile.url = self.url - pyfile.folder = self.folder - pyfile.filename = self.filename - pyfile.status.type = self.status_type - pyfile.status.url = self.status_url - pyfile.status.filename = self.status_filename - pyfile.status.error = self.status_error - - def parsePackage(self, pack): - if pack: - self.pack_id = pack.data["id"] - -class PyLoadPackageData(): - def __init__(self): - self.data = None - self.files = [] - - def set(self, pypack): - self.data = pypack.data - self.files = [PyLoadFileData().set(x) for x in pypack.files] - return self - - def get(self, pypack, fl): - pypack.data = self.data - for fdata in self.files: - pyfile = PyLoadFile(fdata.url, fl) - fdata.get(pyfile) - pyfile.package = pypack - pypack.files.append(pyfile) diff --git a/module/debug.py b/module/debug.py index f3d8ad5cb..8d1ddd3d0 100644 --- a/module/debug.py +++ b/module/debug.py @@ -75,7 +75,7 @@ def initReport(): elif line == "CONFIG:": dest = None - if dest != None: + if dest is not None: dest.append(line) diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 0d4864959..ab728a55b 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -425,7 +425,7 @@ class MainWindow(QMainWindow): item = index.internalPointer() self.emit(SIGNAL("restartDownload"), item.id, isinstance(item, Package)) id, isTopLevel = self.queueContext.item - if not id == None: + if not id is None: self.emit(SIGNAL("restartDownload"), id, isTopLevel) def slotRemoveDownload(self): diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 8b6f679f8..988f532d7 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -182,7 +182,7 @@ class QueueModel(CollectorModel): else: status = item.data["status"] - if speed == None or status == 7 or status == 10 or status == 5: + if speed is None or status == 7 or status == 10 or status == 5: return QVariant(statusMapReverse[status]) else: return QVariant("%s (%s KB/s)" % (statusMapReverse[status], speed)) @@ -242,7 +242,7 @@ class QueueProgressBarDelegate(QItemDelegate): opts.rect.setHeight(option.rect.height()-1) opts.textVisible = True opts.textAlignment = Qt.AlignCenter - if not wait == None: + if not wait is None: opts.text = QString("waiting %d seconds" % (wait,)) else: opts.text = QString.number(opts.progress) + "%" diff --git a/module/network/XdccRequest.py b/module/network/XdccRequest.py index ce764eb12..e6d714b25 100644 --- a/module/network/XdccRequest.py +++ b/module/network/XdccRequest.py @@ -190,7 +190,7 @@ class XdccRequest: continue m = re.match('\x01DCC SEND (.*?) (.*?) (.*?) (.*?)\x01', msg["text"]) - if m != None: + if m is not None: break # kill IRC socket diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index a9b222a6a..4e865b360 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -48,7 +48,7 @@ class FileserveCom(Account): out.update(tmp) return out except: - return Account.getAccountInfo(user) + return Account.getAccountInfo(self, user) def login(self, user, data): req = self.core.requestFactory.getRequest(self.__name__, user) diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index e6e8ba517..0d3e6620f 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -54,7 +54,7 @@ class HotfileCom(Account): out.update(tmp) return out except: - return Account.getAccountInfo(user) + return Account.getAccountInfo(self, user) def apiCall(self, method, post={}, user=None): if user: diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index d8c2aa38d..60b81a2cf 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -114,7 +114,7 @@ class OCR(object): except: pass - def get_captcha(self): + def get_captcha(self, name): raise NotImplementedError def to_greyscale(self): diff --git a/module/plugins/crypter/DDLMusicOrg.py b/module/plugins/crypter/DDLMusicOrg.py index a82fa5a1c..f7cc996d0 100644 --- a/module/plugins/crypter/DDLMusicOrg.py +++ b/module/plugins/crypter/DDLMusicOrg.py @@ -21,7 +21,7 @@ class DDLMusicOrg(Crypter): def decrypt(self, pyfile): html = self.req.load(self.pyfile.url, cookies=True) - if re.search(r"Wer dies nicht rechnen kann", html) != None: + if re.search(r"Wer dies nicht rechnen kann", html) is not None: self.offline() math = re.search(r"(\d+) ([\+-]) (\d+) =\s+> 24 & 0xff] + self.oqmykrna[lahgrnvp >> 16 & 0xff] ^ self.pqmyzkid[lahgrnvp >> 8 & 0xff]) + self.pldmjnde[lahgrnvp & 0xff] - ujhaqylw = lahgrnvp - lahgrnvp = trenlpys - trenlpys = ujhaqylw - ujhaqylw = lahgrnvp - lahgrnvp = trenlpys - trenlpys = ujhaqylw - trenlpys ^= self.ldiwkqly[1] - lahgrnvp ^= self.ldiwkqly[0] - return [lahgrnvp, trenlpys] - + ujhaqylw = 0 + for yalmhopr in range(17, 1, -1): + lahgrnvp ^= self.ldiwkqly[yalmhopr] + trenlpys ^= (self.oqlaoymh[lahgrnvp >> 24 & 0xff] + self.oqmykrna[lahgrnvp >> 16 & 0xff] ^ self.pqmyzkid[lahgrnvp >> 8 & 0xff]) + self.pldmjnde[lahgrnvp & 0xff] + ujhaqylw = lahgrnvp + lahgrnvp = trenlpys + trenlpys = ujhaqylw + ujhaqylw = lahgrnvp + lahgrnvp = trenlpys + trenlpys = ujhaqylw + trenlpys ^= self.ldiwkqly[1] + lahgrnvp ^= self.ldiwkqly[0] + return [lahgrnvp, trenlpys] + def plaomtje(self, yoiumqpy): - qkailkzt = "" - xoliuzem = 0 - lyomiujt = 0 - yploemju = -1 - for i in range(0, len(yoiumqpy)): - yploamzu = ord(yoiumqpy[i]) - if ord('A') <= yploamzu and yploamzu <= ord('Z'): - xoliuzem = ord(yoiumqpy[i]) - 65 - elif ord('a') <= yploamzu and yploamzu <= ord('z'): - xoliuzem = ord(yoiumqpy[i]) - 97 + 26 - elif ord('0') <= yploamzu and yploamzu <= ord('9'): - xoliuzem = ord(yoiumqpy[i]) - 48 + 52 - elif yploamzu == ord('+'): - xoliuzem = 62 - elif yploamzu == ord('/'): - xoliuzem = 63 - else: - continue - yploemju += 1 - - lxkdmizj = 0 - switch = yploemju % 4 - if switch == 0: - lyomiujt = xoliuzem - continue - elif switch == 1: - lxkdmizj = lyomiujt << 2 | xoliuzem >> 4 - lyomiujt = xoliuzem & 0x0F - elif switch == 2: - lxkdmizj = lyomiujt << 4 | xoliuzem >> 2 - lyomiujt = xoliuzem & 0x03 - elif switch == 3: - lxkdmizj = lyomiujt << 6 | xoliuzem >> 0 - lyomiujt = xoliuzem & 0x00 - qkailkzt += unichr(lxkdmizj) - return qkailkzt - + qkailkzt = "" + xoliuzem = 0 + lyomiujt = 0 + yploemju = -1 + for i in range(0, len(yoiumqpy)): + yploamzu = ord(yoiumqpy[i]) + if ord('A') <= yploamzu and yploamzu <= ord('Z'): + xoliuzem = ord(yoiumqpy[i]) - 65 + elif ord('a') <= yploamzu and yploamzu <= ord('z'): + xoliuzem = ord(yoiumqpy[i]) - 97 + 26 + elif ord('0') <= yploamzu and yploamzu <= ord('9'): + xoliuzem = ord(yoiumqpy[i]) - 48 + 52 + elif yploamzu == ord('+'): + xoliuzem = 62 + elif yploamzu == ord('/'): + xoliuzem = 63 + else: + continue + yploemju += 1 + + lxkdmizj = 0 + switch = yploemju % 4 + if switch == 0: + lyomiujt = xoliuzem + continue + elif switch == 1: + lxkdmizj = lyomiujt << 2 | xoliuzem >> 4 + lyomiujt = xoliuzem & 0x0F + elif switch == 2: + lxkdmizj = lyomiujt << 4 | xoliuzem >> 2 + lyomiujt = xoliuzem & 0x03 + elif switch == 3: + lxkdmizj = lyomiujt << 6 | xoliuzem >> 0 + lyomiujt = xoliuzem & 0x00 + qkailkzt += unichr(lxkdmizj) + return qkailkzt + def qmyjuila(self, oqlamykt, yalkionj): - dolizmvw = 0 - for iumswkya in range(0, 16): - oqlamykt ^= self.ldiwkqly[iumswkya] - yalkionj ^= (self.oqlaoymh[oqlamykt >> 24 & 0xff] + self.oqmykrna[oqlamykt >> 16 & 0xff] ^ self.pqmyzkid[oqlamykt >> 8 & 0xff]) + self.pldmjnde[oqlamykt & 0xff] - dolizmvw = oqlamykt - oqlamykt = yalkionj - yalkionj = dolizmvw - dolizmvw = oqlamykt - oqlamykt = yalkionj - yalkionj = dolizmvw - yalkionj ^= self.ldiwkqly[16] - oqlamykt ^= self.ldiwkqly[17] - return [oqlamykt, yalkionj] - + dolizmvw = 0 + for iumswkya in range(0, 16): + oqlamykt ^= self.ldiwkqly[iumswkya] + yalkionj ^= (self.oqlaoymh[oqlamykt >> 24 & 0xff] + self.oqmykrna[oqlamykt >> 16 & 0xff] ^ self.pqmyzkid[oqlamykt >> 8 & 0xff]) + self.pldmjnde[oqlamykt & 0xff] + dolizmvw = oqlamykt + oqlamykt = yalkionj + yalkionj = dolizmvw + dolizmvw = oqlamykt + oqlamykt = yalkionj + yalkionj = dolizmvw + yalkionj ^= self.ldiwkqly[16] + oqlamykt ^= self.ldiwkqly[17] + return [oqlamykt, yalkionj] + def ykijmtkd(self, yoirlkqw): - loipamyu = len(yoirlkqw) - yoirlkqwchar = [] - for ymujtnbq in range(0, loipamyu): - yoir = [yoirlkqw[ymujtnbq] >> 24 & 0xff, yoirlkqw[ymujtnbq] >> 16 & 0xff, yoirlkqw[ymujtnbq] >> 8 & 0xff, yoirlkqw[ymujtnbq] & 0xff] - for c in yoir: - yoirlkqwchar.append(chr(c)) - return "".join(yoirlkqwchar) - + loipamyu = len(yoirlkqw) + yoirlkqwchar = [] + for ymujtnbq in range(0, loipamyu): + yoir = [yoirlkqw[ymujtnbq] >> 24 & 0xff, yoirlkqw[ymujtnbq] >> 16 & 0xff, yoirlkqw[ymujtnbq] >> 8 & 0xff, yoirlkqw[ymujtnbq] & 0xff] + for c in yoir: + yoirlkqwchar.append(chr(c)) + return "".join(yoirlkqwchar) + def ylomiktb(self, lofiuzmq): - plokimqw = int(ceil(len(lofiuzmq) / 4.0)) + plokimqw = int(ceil(len(lofiuzmq) / 4.0)) lopkisdq = [] - for ypoqlktz in range(0, plokimqw): + for ypoqlktz in range(0, plokimqw): lopkisdq.append(ord(lofiuzmq[(ypoqlktz << 2) + 3]) + (ord(lofiuzmq[(ypoqlktz << 2) + 2]) << 8) + (ord(lofiuzmq[(ypoqlktz << 2) + 1]) << 16) + (ord(lofiuzmq[(ypoqlktz << 2)]) << 24)) - return lopkisdq - + return lopkisdq + def yoliukev(self, kaiumylq): - self.oqlaoymh = self.iatwbfrd - self.oqmykrna = self.ybghjtik - self.pqmyzkid = self.thdlpsmy - self.pldmjnde = self.plkodnyq - - yaqpolft = [0 for i in range(len(kaiumylq))] - + self.oqlaoymh = self.iatwbfrd + self.oqmykrna = self.ybghjtik + self.pqmyzkid = self.thdlpsmy + self.pldmjnde = self.plkodnyq + + yaqpolft = [0 for i in range(len(kaiumylq))] + yaqwsedr = 0 - btzqwsay = 0 - while yaqwsedr < len(kaiumylq): - wlqoakmy = 0 - for lopiuztr in range(0, 4): - wlqoakmy = wlqoakmy << 8 | ord(kaiumylq[yaqwsedr % len(kaiumylq)]) - yaqwsedr += 1 + btzqwsay = 0 + while yaqwsedr < len(kaiumylq): + wlqoakmy = 0 + for lopiuztr in range(0, 4): + wlqoakmy = wlqoakmy << 8 | ord(kaiumylq[yaqwsedr % len(kaiumylq)]) + yaqwsedr += 1 yaqpolft[btzqwsay] = wlqoakmy - btzqwsay += 1 - self.ldiwkqly = [] - for btzqwsay in range(0, 18): - self.ldiwkqly.append(self.olkemfjq[btzqwsay]) - yalopiuq = [0, 0] - for btzqwsay in range(0, 18, 2): - yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) - self.ldiwkqly[btzqwsay] = yalopiuq[0] - self.ldiwkqly[btzqwsay + 1] = yalopiuq[1] - for btzqwsay in range(0, 256, 2): - yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) - self.oqlaoymh[btzqwsay] = yalopiuq[0] - self.oqlaoymh[btzqwsay + 1] = yalopiuq[1] - for btzqwsay in range(0, 256, 2): - yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) - self.oqmykrna[btzqwsay] = yalopiuq[0] - self.oqmykrna[btzqwsay + 1] = yalopiuq[1] - for btzqwsay in range(0, 256, 2): - yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) - self.pqmyzkid[btzqwsay] = yalopiuq[0] - self.pqmyzkid[btzqwsay + 1] = yalopiuq[1] - for btzqwsay in range(0, 256, 2): - yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) - self.pldmjnde[btzqwsay] = yalopiuq[0] + btzqwsay += 1 + self.ldiwkqly = [] + for btzqwsay in range(0, 18): + self.ldiwkqly.append(self.olkemfjq[btzqwsay]) + yalopiuq = [0, 0] + for btzqwsay in range(0, 18, 2): + yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) + self.ldiwkqly[btzqwsay] = yalopiuq[0] + self.ldiwkqly[btzqwsay + 1] = yalopiuq[1] + for btzqwsay in range(0, 256, 2): + yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) + self.oqlaoymh[btzqwsay] = yalopiuq[0] + self.oqlaoymh[btzqwsay + 1] = yalopiuq[1] + for btzqwsay in range(0, 256, 2): + yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) + self.oqmykrna[btzqwsay] = yalopiuq[0] + self.oqmykrna[btzqwsay + 1] = yalopiuq[1] + for btzqwsay in range(0, 256, 2): + yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) + self.pqmyzkid[btzqwsay] = yalopiuq[0] + self.pqmyzkid[btzqwsay + 1] = yalopiuq[1] + for btzqwsay in range(0, 256, 2): + yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1]) + self.pldmjnde[btzqwsay] = yalopiuq[0] self.pldmjnde[btzqwsay + 1] = yalopiuq[1] diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index c91341887..28d0819d7 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -32,12 +32,12 @@ class DepositfilesCom(Hoster): self.download(link) def handleFree(self): - if re.search(r'File is checked, please try again in a minute.', self.html) != None: + if re.search(r'File is checked, please try again in a minute.', self.html) is not None: self.log.info("DepositFiles.com: The file is being checked. Waiting 1 minute.") self.setWait(61) self.wait() - if re.search(r'Such file does not exist or it has been removed for infringement of copyrights', self.html) != None: + if re.search(r'Such file does not exist or it has been removed for infringement of copyrights', self.html) is not None: self.offline() self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ff09d9a0a..753baa800 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -2,26 +2,26 @@ import re from module.plugins.Hoster import Hoster -from module.plugins.ReCaptcha import ReCaptcha - +from module.plugins.ReCaptcha import ReCaptcha + from module.network.Request import getURL - -def getInfo(urls): - result = [] - - for url in urls: + +def getInfo(urls): + result = [] + + for url in urls: html = getURL(url) if re.search(r'

File not available

', html): - result.append((url, 0, 1, url)) - continue - + result.append((url, 0, 1, url)) + continue + size = re.search(r"(.*?) MB", html).group(1) - size = int(float(size)*1024*1024) + size = int(float(size)*1024*1024) - name = re.search('

(.*?)

', html).group(1) - result.append((name, size, 2, url)) - - yield result + name = re.search('

(.*?)

', html).group(1) + result.append((name, size, 2, url)) + + yield result class FileserveCom(Hoster): __name__ = "FileserveCom" @@ -38,20 +38,20 @@ class FileserveCom(Hoster): def process(self, pyfile): self.html = self.load(self.pyfile.url, cookies=False if self.account else True) - if re.search(r'

File not available

', self.html) != None: - self.offline + if re.search(r'

File not available

', self.html) is not None: + self.offline() self.pyfile.name = re.search('

(.*?)

', self.html).group(1) - - if self.account: - self.handlePremium() - else: - self.handleFree() - - def handlePremium(self): - self.download(self.pyfile.url, post={"download":"premium"}, cookies=True) - - def handleFree(self): + + if self.account: + self.handlePremium() + else: + self.handleFree() + + def handlePremium(self): + self.download(self.pyfile.url, post={"download":"premium"}, cookies=True) + + def handleFree(self): if r'