From ed3b4cd5e100b5df44b45c55a00d49b208cb0a11 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 14 Nov 2010 14:08:38 +0100 Subject: LinkList fix, update fix, crypter fix --- module/PluginManager.py | 9 +++++++- module/PluginThread.py | 3 +-- module/ThreadManager.py | 39 ++++------------------------------ module/plugins/container/LinkList.py | 20 +++++++++-------- module/plugins/hoster/FreakshareCom.py | 2 +- module/web/settings.py | 2 +- pyLoadCore.py | 21 ++++++------------ 7 files changed, 32 insertions(+), 64 deletions(-) diff --git a/module/PluginManager.py b/module/PluginManager.py index e7a00a835..3f11c067b 100644 --- a/module/PluginManager.py +++ b/module/PluginManager.py @@ -36,6 +36,10 @@ try: except ImportError: # python 2.5 from module.SafeEval import safe_eval as literal_eval + +IGNORE = ["FreakshareNet"] +#ignore this plugins in homefolder, add deleted plugins here + class PluginManager(): def __init__(self, core): self.core = core @@ -83,7 +87,7 @@ class PluginManager(): self.captchaPlugins = self.parse(_("Captcha"), "captcha") self.accountPlugins = self.parse(_("Account"), "accounts", create=True) self.hookPlugins = self.parse(_("Hook"), "hooks") - + self.log.debug(_("created index of plugins")) def parse(self, typ, folder, create=False, pattern=False, home={}): @@ -142,6 +146,9 @@ class PluginManager(): module = f.replace(".pyc","").replace(".py","") if home: + if name in IGNORE: + del plugins[name] + continue path = "userplugins.%s.%s" % (folder, module) else: path = "module.plugins.%s.%s" % (folder, module) diff --git a/module/PluginThread.py b/module/PluginThread.py index 9cce3a42e..20cb10a5b 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -308,7 +308,7 @@ class DecrypterThread(PluginThread): pyfile = self.active retry = False - + try: self.m.log.info(_("Decrypting starts: %s") % self.active.name) self.active.plugin.preprocessing(self) @@ -360,7 +360,6 @@ class DecrypterThread(PluginThread): finally: if not retry: - self.m.removeOccupiedCrypter(pyfile.pluginname) self.active.release() self.active = False self.m.core.files.save() diff --git a/module/ThreadManager.py b/module/ThreadManager.py index a2a8b0411..eba23f28c 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -25,7 +25,6 @@ from threading import Event from time import sleep from traceback import print_exc from random import choice -from threading import Lock import pycurl import PluginThread @@ -57,30 +56,8 @@ class ThreadManager: for i in range(0, self.core.config.get("general", "max_downloads")): self.createThread() - self.occupiedCrypter = [] - self.occupiedCrypterLock = Lock() - - #---------------------------------------------------------------------- - def addOccupiedCrypter(self, name): - self.occupiedCrypterLock.acquire() - self.occupiedCrypter.append(name) - self.occupiedCrypterLock.release() - - def removeOccupiedCrypter(self, name): - self.occupiedCrypterLock.acquire() - if name in self.occupiedCrypter: - self.occupiedCrypter.remove(name) - self.occupiedCrypterLock.release() - - def isOccupiedCrypter(self, name): - self.occupiedCrypterLock.acquire() - ret = 0 - for plugin in self.occupiedCrypter: - if name == plugin: - ret += 1 - self.occupiedCrypterLock.release() - return ret - + + #---------------------------------------------------------------------- def createThread(self): """create a download thread""" @@ -253,19 +230,11 @@ class ThreadManager: job = self.core.files.getDecryptJob() if job: job.initPlugin() - if job.plugin.multiDL or self.isOccupiedCrypter(job.pluginname) < job.plugin.limitDL: - thread = PluginThread.DecrypterThread(self, job) - if not job.plugin.multiDL: - print "add" - self.addOccupiedCrypter(job.pluginname) + thread = PluginThread.DecrypterThread(self, job) else: - if job.plugin.multiDL or self.isOccupiedCrypter(job.pluginname) < job.plugin.limitDL: - thread = PluginThread.DecrypterThread(self, job) - if not job.plugin.multiDL: - print "add" - self.addOccupiedCrypter(job.pluginname) + thread = PluginThread.DecrypterThread(self, job) def cleanup(self): """do global cleanup""" diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index d352d0b49..2bbe905c1 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -6,18 +6,18 @@ from module.plugins.Container import Container class LinkList(Container): __name__ = "LinkList" - __version__ = "0.1" - __pattern__ = r".*\.txt$" + __version__ = "0.11" + __pattern__ = r".+\.txt$" __description__ = """Read Link Lists in txt format""" + __config__ = [("clear", "Clear LinkList", "bool", True)] __author_name__ = ("spoob", "jeix") __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") def decrypt(self, pyfile): - txt = open(pyfile.url, 'r') links = txt.readlines() - curPack = "Parsed links %s" % pyfile.name + curPack = "Parsed links from %s" % pyfile.name packages = {curPack:[],} @@ -46,11 +46,13 @@ class LinkList(Container): for key in delete: del packages[key] - if not self.core.debug: - txt = open(linkList, 'w') - txt.write("") - txt.close() - #@TODO: maybe delete read txt file? + if self.getConfig("clear"): + try: + txt = open(pyfile.url, 'wb') + txt.write("") + 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/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 441bdcd8f..795cafadf 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -9,7 +9,7 @@ class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" - __version__ = "0.32" + __version__ = "0.33" __description__ = """Freakshare.com Download Hoster""" __author_name__ = ("sitacuisses","spoob","mkaay") __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") diff --git a/module/web/settings.py b/module/web/settings.py index c087cc6bf..3b392cf37 100644 --- a/module/web/settings.py +++ b/module/web/settings.py @@ -54,7 +54,7 @@ except: PYLOAD = xmlrpclib.ServerProxy(server_url, allow_none=True) -DEBUG = config.get("general","debug_mode") +DEBUG = TEMPLATE_DEBUG = config.get("general","debug_mode") from module.JsEngine import JsEngine JS = JsEngine() diff --git a/pyLoadCore.py b/pyLoadCore.py index 29b77b13a..2c643e16b 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -354,25 +354,16 @@ class Core(object): if exists(link_file): f = open(link_file, "rb") - links = [x.strip() for x in f.readlines() if x.strip()] - if links: - self.server_methods.add_package("links.txt", links, 1) - f.close() - try: - f = open(link_file, "wb") - f.close() - except: - self.log.warning(_("links.txt could not be cleared")) + if f.read().strip(): + self.server_methods.add_package("links.txt", [link_file], 1) + f.close() link_file = "links.txt" if exists(link_file): f = open(link_file, "rb") - links = [x.strip() for x in f.readlines() if x.strip()] - if links: - self.server_methods.add_package("links.txt", links, 1) - f.close() - f = open(link_file, "wb") - f.close() + if f.read().strip(): + self.server_methods.add_package("links.txt", [link_file], 1) + f.close() self.scheduler.addJob(0, self.accountManager.getAccountInfos) -- cgit v1.2.3