diff options
Diffstat (limited to 'module')
35 files changed, 279 insertions, 768 deletions
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 <http://www.gnu.org/licenses/>. - - @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+<inp", self.html) diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index a40e5104b..7dd52ba40 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -27,7 +27,7 @@ class HoerbuchIn(Crypter): """ returns True or False """ self.download_html() - if re.search(r"Download", self.html) != None: + if re.search(r"Download", self.html) is not None: return True return False diff --git a/module/plugins/crypter/SecuredIn.py b/module/plugins/crypter/SecuredIn.py index 5a246075f..ef2ac5956 100644 --- a/module/plugins/crypter/SecuredIn.py +++ b/module/plugins/crypter/SecuredIn.py @@ -84,19 +84,19 @@ class SecuredIn(Crypter): 0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a - ]
-
+ ] + self.olkemfjq = [ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b - ]
-
+ ] + self.oqlaoymh = 0 self.oqmykrna = 0 self.pqmyzkid = 0 self.pldmjnde = 0 - self.ldiwkqly = 0
-
+ self.ldiwkqly = 0 + self.plkodnyq = [ 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, @@ -122,10 +122,10 @@ class SecuredIn(Crypter): 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 - ]
-
- self.pnjzokye = None
-
+ ] + + self.pnjzokye = None + self.thdlpsmy = [ 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, @@ -151,8 +151,8 @@ class SecuredIn(Crypter): 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 - ]
-
+ ] + self.ybghjtik = [ 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, @@ -180,155 +180,155 @@ class SecuredIn(Crypter): 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 ] - def cypher(self, code):
- return self.lskdqpyr(code, "")
-
+ def cypher(self, code): + return self.lskdqpyr(code, "") + def lskdqpyr(self, alokfmth, yoaksjdh): - if self.pnjzokye == None or self.pnjzokye.lower() == yoaksjdh:
- self.yoliukev(yoaksjdh)
- self.pnjzokye = yoaksjdh
- alokfmth = self.plaomtje(alokfmth)
- ykaiumgp = ""
- alokijuh = len(alokfmth)
- lokimyas = self.ylomiktb(alokfmth[0:8])
- palsiuzt = lokimyas[0]
- tzghbndf = lokimyas[1]
- awsedrft = [None, None]
- for kiujzhqa in range(8, alokijuh, 8):
- lokimyas = self.ylomiktb(alokfmth[kiujzhqa:kiujzhqa+8])
- awsedrft[0] = lokimyas[0]
- awsedrft[1] = lokimyas[1]
- lokimyas = self.okaqnhlp(lokimyas[0], lokimyas[1])
- lokimyas[0] ^= palsiuzt
- lokimyas[1] ^= tzghbndf
- palsiuzt = awsedrft[0]
- tzghbndf = awsedrft[1]
- ykaiumgp += self.ykijmtkd(lokimyas)
- return ykaiumgp
-
+ if self.pnjzokye is None or self.pnjzokye.lower() == yoaksjdh: + self.yoliukev(yoaksjdh) + self.pnjzokye = yoaksjdh + alokfmth = self.plaomtje(alokfmth) + ykaiumgp = "" + alokijuh = len(alokfmth) + lokimyas = self.ylomiktb(alokfmth[0:8]) + palsiuzt = lokimyas[0] + tzghbndf = lokimyas[1] + awsedrft = [None, None] + for kiujzhqa in range(8, alokijuh, 8): + lokimyas = self.ylomiktb(alokfmth[kiujzhqa:kiujzhqa+8]) + awsedrft[0] = lokimyas[0] + awsedrft[1] = lokimyas[1] + lokimyas = self.okaqnhlp(lokimyas[0], lokimyas[1]) + lokimyas[0] ^= palsiuzt + lokimyas[1] ^= tzghbndf + palsiuzt = awsedrft[0] + tzghbndf = awsedrft[1] + ykaiumgp += self.ykijmtkd(lokimyas) + return ykaiumgp + def okaqnhlp(self, 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]
-
+ 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'<h1>File not available</h1>', html):
- result.append((url, 0, 1, url)) - continue - + result.append((url, 0, 1, url))
+ continue
+
size = re.search(r"<span><strong>(.*?) MB</strong>", html).group(1)
- size = int(float(size)*1024*1024) + size = int(float(size)*1024*1024)
- name = re.search('<h1>(.*?)<br/></h1>', html).group(1) - result.append((name, size, 2, url)) - - yield result + name = re.search('<h1>(.*?)<br/></h1>', 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'<h1>File not available</h1>', self.html) != None:
- self.offline
+ if re.search(r'<h1>File not available</h1>', self.html) is not None:
+ self.offline()
self.pyfile.name = re.search('<h1>(.*?)<br/></h1>', 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'<div id="captchaArea" style="display:none;">' in self.html or \
r'/showCaptcha\(\);' in self.html:
@@ -72,11 +72,11 @@ class FileserveCom(Hoster): wait_time = 30
m = re.search(r'<span>(.*?)\sSekunden</span>', html)
- if m != None:
+ if m is not None:
wait_time = int( m.group(1).split('.')[0] ) + 1
m = re.search(r'You need to wait (.*?) seconds to start another download.', html)
- if m != None:
+ if m is not None:
wait_time = int( m.group(1) )
self.wantReconnect = True
diff --git a/module/plugins/hoster/FreakshareNet.py b/module/plugins/hoster/FreakshareNet.py index 1bb36737e..76a906ad2 100644 --- a/module/plugins/hoster/FreakshareNet.py +++ b/module/plugins/hoster/FreakshareNet.py @@ -37,7 +37,7 @@ class FreakshareNet(Hoster): self.download_html() if not self.file_exists(): - self.offline + self.offline() self.setWait( self.get_waiting_time() ) @@ -54,7 +54,7 @@ class FreakshareNet(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html == None: + if self.html is None: self.download_html() if not self.wantReconnect: self.req_opts = self.get_download_options() # get the Post options for the Request @@ -64,7 +64,7 @@ class FreakshareNet(Hoster): self.offline() def get_file_name(self): - if self.html == None: + if self.html is None: self.download_html() if not self.wantReconnect: file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center\;\">([^ ]+)", self.html).group(1) @@ -73,7 +73,7 @@ class FreakshareNet(Hoster): return self.pyfile.url def get_waiting_time(self): - if self.html == None: + if self.html is None: self.download_html() timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) if timestring: @@ -85,9 +85,9 @@ class FreakshareNet(Hoster): def file_exists(self): """ returns True or False """ - if self.html == None: + if self.html is None: self.download_html() - if re.search(r"Sorry, this Download doesnt exist anymore", self.html) != None: + if re.search(r"Sorry, this Download doesnt exist anymore", self.html) is not None: return False else: return True diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 78128db1d..d5d255b1a 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -23,7 +23,7 @@ def getInfo(urls): if fields[1] in ("1", "2"): status = 2 - elif fields[1]: + else: status = 1 result.append((fields[2], int(fields[3]), status, chunk[i])) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index a14c2c76f..3e257d0b1 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -80,7 +80,7 @@ class MegauploadCom(Hoster): captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) self.html[1] = self.load(self.pyfile.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}) - if re.search(r"Waiting time before each download begins", self.html[1]) != None: + if re.search(r"Waiting time before each download begins", self.html[1]) is not None: break def get_file_url(self): @@ -94,7 +94,7 @@ class MegauploadCom(Hoster): def file_exists(self): self.download_html() - if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \ + if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) is not None or \ re.search(r"Download limit exceeded", self.html[0]): return False return True diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py index 7ea045447..e4b41605b 100644 --- a/module/plugins/hoster/MegavideoCom.py +++ b/module/plugins/hoster/MegavideoCom.py @@ -27,7 +27,7 @@ class MegavideoCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html == None: + if self.html is None: self.download_html() # get id @@ -90,7 +90,7 @@ class MegavideoCom(Hoster): return out.lower() def get_file_name(self): - if self.html == None: + if self.html is None: self.download_html() name = re.search("flashvars.title = \"(.*?)\";", self.html).group(1) @@ -100,11 +100,11 @@ class MegavideoCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html == None: + if self.html is None: self.download_html() - if re.search(r"Dieses Video ist nicht verfügbar.", self.html) != None or \ - re.search(r"This video is unavailable.", self.html) != None: + if re.search(r"Dieses Video ist nicht verfügbar.", self.html) is not None or \ + re.search(r"This video is unavailable.", self.html) is not None: return False else: return True diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 6f0cb9461..dc5d2a028 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -28,7 +28,7 @@ def getInfo(urls): api = getURL(apiurl+ids) - if api == None or len(api) < 10: + if api is None or len(api) < 10: print "Netload prefetch: failed " return if api.find("unknown_auth") >= 0: @@ -111,7 +111,7 @@ class NetloadIn(Hoster): if self.api_data["status"] == "online": self.api_data["checksum"] = lines[4].strip() else: - self.offline(); + self.offline() else: self.api_data["exists"] = False else: @@ -134,12 +134,12 @@ class NetloadIn(Hoster): if self.getConf('dumpgen'): print page - if re.search(r"(We will prepare your download..)", page) != None: + if re.search(r"(We will prepare your download..)", page) is not None: self.log.debug("Netload: We will prepare your download") - self.final_wait(page); + self.final_wait(page) return True - if re.search(r"(We had a reqeust with the IP)", page) != None: - wait = self.get_wait_time(page); + if re.search(r"(We had a reqeust with the IP)", page) is not None: + wait = self.get_wait_time(page) if wait == 0: self.log.debug("Netload: Wait was 0 setting 30") wait = 30 @@ -149,7 +149,7 @@ class NetloadIn(Hoster): self.wait() link = re.search(r"You can download now your next file. <a href=\"(index.php\?id=10&.*)\" class=\"Orange_Link\">Click here for the download</a>", page) - if link != None: + if link is not None: self.log.debug("Netload: Using new link found on page") page = self.load("http://netload.in/" + link.group(1).replace("amp;", "")) else: @@ -172,7 +172,7 @@ class NetloadIn(Hoster): file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', page).group(1) if not captchawaited: - wait = self.get_wait_time(page); + wait = self.get_wait_time(page) self.log.info(_("Netload: waiting for captcha %d s." % wait)) self.setWait(wait) self.wait() @@ -189,13 +189,13 @@ class NetloadIn(Hoster): try: file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\" >Click here" attempt = re.search(file_url_pattern, page) - if attempt != None: + if attempt is not None: return attempt.group(1) else: self.log.debug("Netload: Backup try for final link") file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here" attempt = re.search(file_url_pattern, page) - return "http://netload.in/"+attempt.group(1); + return "http://netload.in/"+attempt.group(1) except: self.log.debug("Netload: Getting final link failed") return None diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 5dd681b5b..7a969f7f7 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -30,7 +30,7 @@ class PornhostCom(Hoster): def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html)
@@ -46,7 +46,7 @@ class PornhostCom(Hoster): return file_url
def get_file_name(self):
- if self.html == None:
+ if self.html is None:
self.download_html()
name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html)
@@ -64,11 +64,11 @@ class PornhostCom(Hoster): def file_exists(self):
""" returns True or False
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
- if re.search(r'gallery not found', self.html) != None \
- or re.search(r'You will be redirected to', self.html) != None:
+ if re.search(r'gallery not found', self.html) is not None \
+ or re.search(r'You will be redirected to', self.html) is not None:
return False
else:
return True
diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index ea7e1423c..abc489e30 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -28,7 +28,7 @@ class PornhubCom(Hoster): def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
url = "http://www.pornhub.com//gateway.php"
@@ -46,7 +46,7 @@ class PornhubCom(Hoster): return file_url
def get_file_name(self):
- if self.html == None:
+ if self.html is None:
self.download_html()
name = re.findall('<h1>(.*?)</h1>', self.html)[1] + ".flv"
@@ -56,10 +56,10 @@ class PornhubCom(Hoster): def file_exists(self):
""" returns True or False
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
- if re.search(r'This video is no longer in our database or is in conversion', self.html) != None:
+ if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None:
return False
else:
return True
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index f9af201cb..844d716ed 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -113,12 +113,8 @@ class RapidshareCom(Hoster): if src.startswith("ERROR"): return fields = src.split(",") - self.api_data = {} - self.api_data["fileid"] = fields[0] - self.api_data["filename"] = fields[1] - self.api_data["size"] = int(fields[2]) # in bytes - self.api_data["serverid"] = fields[3] - self.api_data["status"] = fields[4] + self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3], + "status": fields[4]} """ status codes: 0=File not found @@ -155,7 +151,7 @@ class RapidshareCom(Hoster): self.wantReconnect = True return 60 * int(wait_minutes) + 60 except: - if re.search(r"(Currently a lot of users|no more download slots|servers are overloaded)", self.html[1], re.I) != None: + if re.search(r"(Currently a lot of users|no more download slots|servers are overloaded)", self.html[1], re.I) is not None: self.log.info(_("Rapidshare: No free slots!")) self.no_slots = True return time() + 130 diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index 6a9baffbe..748ab04f0 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -29,7 +29,7 @@ class RedtubeCom(Hoster): def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1))
@@ -37,7 +37,7 @@ class RedtubeCom(Hoster): return file_url
def get_file_name(self):
- if self.html == None:
+ if self.html is None:
self.download_html()
name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv"
@@ -46,10 +46,10 @@ class RedtubeCom(Hoster): def file_exists(self):
""" returns True or False
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
- if re.search(r'This video has been removed.', self.html) != None:
+ if re.search(r'This video has been removed.', self.html) is not None:
return False
else:
return True
diff --git a/module/plugins/hoster/ShareCx.py b/module/plugins/hoster/ShareCx.py index e64459754..63a51eab7 100644 --- a/module/plugins/hoster/ShareCx.py +++ b/module/plugins/hoster/ShareCx.py @@ -62,7 +62,7 @@ class ShareCx(Hoster): def doDownload(self):
""" returns the absolute downloadable filepath
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
op = re.search(r'name="op" value="(.*?)"', self.html).group(1)
@@ -83,7 +83,7 @@ class ShareCx(Hoster): m = re.search(r'startTimer\((\d+)\)', self.html)
- if m != None:
+ if m is not None:
wait_time = int(m.group(1))
self.setWait(wait_time)
self.wantReconnect = True
@@ -91,9 +91,9 @@ class ShareCx(Hoster): self.wait()
m = re.search(r'countdown">.*?(\d+).*?</span>', self.html)
- if m == None:
+ if m is None:
m = re.search(r'id="countdown_str".*?<span id=".*?">.*?(\d+).*?</span', self.html)
- if m != None:
+ if m is not None:
wait_time = int(m.group(1))
self.setWait(wait_time)
self.wantReconnect = False
@@ -120,7 +120,7 @@ class ShareCx(Hoster): }
if '/captchas/' in self.html:
- captcha_url = re.search(r'(http://(?:[\w\d]+\.)?.*?/captchas/.*?)').group(1)
+ captcha_url = re.search(r'(http://(?:[\w\d]+\.)?.*?/captchas/.*?)', self.html).group(1)
captcha = self.decryptCaptcha(captcha_url)
data["code"] = captcha
@@ -135,7 +135,7 @@ class ShareCx(Hoster): # postfields["method_free"] = "Datei herunterladen"
def get_file_name(self):
- if self.html == None:
+ if self.html is None:
self.download_html()
name = re.search(r'alt="Download" /></span>(.*?)</h3>', self.html).group(1)
@@ -144,10 +144,10 @@ class ShareCx(Hoster): def file_exists(self):
""" returns True or False
"""
- if self.html == None:
+ if self.html is None:
self.download_html()
- if re.search(r'File not found<br>It was deleted due to inactivity or abuse request', self.html) != None:
+ if re.search(r'File not found<br>It was deleted due to inactivity or abuse request', self.html) is not None:
return False
return True
diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index e634607b0..65d2787f0 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -24,7 +24,7 @@ class ShragleCom(Hoster): def set_parent_status(self): """ sets all available Statusinfos about a File in self.parent.status """ - if self.html == None: + if self.html is None: self.download_html() self.parent.status.filename = self.get_file_name() self.parent.status.url = self.get_file_url() @@ -38,7 +38,7 @@ class ShragleCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html == None: + if self.html is None: self.download_html() self.fileID = re.search(r"name=\"fileID\" value=\"([^\"]+)", self.html).group(1) @@ -49,7 +49,7 @@ class ShragleCom(Hoster): return "http://srv4.shragle.com/download.php" def get_file_name(self): - if self.html == None: + if self.html is None: self.download_html() file_name_pattern = r"<\/div><h2>(.+)<\/h2" @@ -58,10 +58,10 @@ class ShragleCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html == None: + if self.html is None: self.download_html() - if re.search(r"html", self.html) == None: + if re.search(r"html", self.html) is None: return False else: return True diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index a2165bd5e..b0c3486e3 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -137,7 +137,7 @@ class UploadedTo(Hoster): return self.pyfile.url.split('/')[-1] def file_exists(self): - if re.search(r"(File doesn't exist)", self.html) != None: + if re.search(r"(File doesn't exist)", self.html) is not None: return False else: return True diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 5c07f2c84..fb9ef5a02 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -23,7 +23,7 @@ class YoupornCom(Hoster): def set_parent_status(self): """ sets all available Statusinfos about a File in self.parent.status """ - if self.html == None: + if self.html is None: self.download_html() self.parent.status.filename = self.get_file_name() self.parent.status.url = self.get_file_url() @@ -36,14 +36,14 @@ class YoupornCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html == None: + if self.html is None: self.download_html() file_url = re.search(r'(http://download.youporn.com/download/\d*/.*\?download=1&ll=1&t=dd)">', self.html).group(1) return file_url def get_file_name(self): - if self.html == None: + if self.html is None: self.download_html() file_name_pattern = r".*<title>(.*) - Free Porn Videos - YouPorn.com Lite \(BETA\)</title>.*" @@ -52,9 +52,9 @@ class YoupornCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html == None: + if self.html is None: self.download_html() - if re.search(r"(.*invalid video_id.*)", self.html) != None: + if re.search(r"(.*invalid video_id.*)", self.html) is not None: return False else: return True diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 79c359ad7..6b69c3fd4 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -17,7 +17,7 @@ class YoutubeCom(Hoster): def process(self, pyfile): html = self.load(pyfile.url) - if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) != None: + if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) is not None: self.offline() videoId = pyfile.url.split("v=")[1].split("&")[0] diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 3740f8c14..d42ce3578 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -41,7 +41,7 @@ class ZippyshareCom(Hoster): return file_url def get_file_name(self): - if self.html == None: + if self.html is None: self.download_html() if not self.wantReconnect: file_name = re.search(r'Name: </font> <font.*>(.*?)</font>', self.html).group(1) @@ -52,9 +52,9 @@ class ZippyshareCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html == None: + if self.html is None: self.download_html() - if re.search(r'File does not exist on this server', self.html) != None: + if re.search(r'File does not exist on this server', self.html) is not None: return False else: return True diff --git a/module/pyunrar.py b/module/pyunrar.py index 1d17486a4..413d8275e 100644 --- a/module/pyunrar.py +++ b/module/pyunrar.py @@ -319,7 +319,7 @@ class Unrar(): if not statusFunction: statusFunction = lambda p: None statusFunction(0) - while ret == None or tmp: + while ret is None or tmp: tmp = p.stdout.read(1) if tmp: out += tmp diff --git a/module/remote/SecureXMLRPCServer.py b/module/remote/SecureXMLRPCServer.py index 7a60f6c90..48586ee0b 100644 --- a/module/remote/SecureXMLRPCServer.py +++ b/module/remote/SecureXMLRPCServer.py @@ -76,7 +76,7 @@ class AuthXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): def do_POST(self): # authentication - if self.authMap != None: # explicit None! + if self.authMap is not None: # explicit None! if self.headers.has_key('authorization') and self.headers['authorization'].startswith('Basic '): authenticationString = base64.b64decode(self.headers['authorization'].split(' ')[1]) if authenticationString.find(':') != -1: diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index 82e478af3..7d5c1884c 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -59,7 +59,7 @@ def add_package(request): try: f = request.FILES['add_file'] - if name == None or name == "": + if name is None or name == "": name = f.name fpath = join(settings.PYLOAD.get_conf_val("general","download_folder"), "tmp_"+ f.name) @@ -71,7 +71,7 @@ def add_package(request): except: pass - if name == None or name == "": + if name is None or name == "": return HttpResponseServerError() links = map(lambda x: x.strip(), links) diff --git a/module/web/media/default/js/sprintf.js b/module/web/media/default/js/sprintf.js index 30d9046de..385285340 100644 --- a/module/web/media/default/js/sprintf.js +++ b/module/web/media/default/js/sprintf.js @@ -35,7 +35,7 @@ sprintfWrapper = { min: match[6] || 0,
precision: match[8],
code: match[9] || '%',
- negative: parseInt(arguments[convCount]) < 0 ? true : false,
+ negative: parseInt(arguments[convCount]) < 0,
argument: String(arguments[convCount])
};
}
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 615840428..dd367f7f3 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -186,8 +186,8 @@ def download(request, path): @check_server def logs(request, item=-1): - perpage = request.session.get('perpage', 34); - reversed = request.session.get('reversed', False); + perpage = request.session.get('perpage', 34) + reversed = request.session.get('reversed', False) warning = "" conf = settings.PYLOAD.get_config() @@ -195,7 +195,7 @@ def logs(request, item=-1): warning = "Warning: File log is disabled, see settings page." perpage_p = ((20,20), (34, 34), (40, 40), (100, 100), (0,'all')) - fro = None; + fro = None if request.method == 'POST': try: @@ -230,8 +230,8 @@ def logs(request, item=-1): counter = 0 perpagecheck = 0 for l in log: - counter = counter+1; - + counter = counter+1 + if counter >= item: try: date,time,level,message = l.split(" ", 3) @@ -241,18 +241,18 @@ def logs(request, item=-1): date = '?' time = ' ' level = '?' - message = l; - if item == -1 and dtime != None and fro <= dtime: + message = l + if item == -1 and dtime is not None and fro <= dtime: item = counter #found our datetime if item >= 0: data.append({'line': counter, 'date': date+" "+time, 'level':level, 'message': message}) - perpagecheck = perpagecheck +1; - if fro == None and dtime != None: #if fro not set set it to first showed line - fro = dtime; + perpagecheck = perpagecheck +1 + if fro is None and dtime is not None: #if fro not set set it to first showed line + fro = dtime if perpagecheck >= perpage and perpage > 0: break - if fro == None: #still not set, empty log? + if fro is None: #still not set, empty log? fro = datetime.now() if reversed: data.reverse() |