diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-01 00:08:11 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-01 00:08:11 +0100 |
commit | 95270599f2a0d0042c75f63f30a3e013849439f7 (patch) | |
tree | ced2dc611ed51e43251b980e2a1578fe90674858 /pyload/plugins/addons | |
parent | Updated translations (diff) | |
download | pyload-95270599f2a0d0042c75f63f30a3e013849439f7.tar.xz |
fixed are few addons and improved crypter workarounds
Diffstat (limited to 'pyload/plugins/addons')
-rw-r--r-- | pyload/plugins/addons/ClickAndLoad.py | 18 | ||||
-rw-r--r-- | pyload/plugins/addons/ExternalScripts.py | 27 | ||||
-rw-r--r-- | pyload/plugins/addons/ExtractArchive.py | 2 |
3 files changed, 23 insertions, 24 deletions
diff --git a/pyload/plugins/addons/ClickAndLoad.py b/pyload/plugins/addons/ClickAndLoad.py index 0fc78abfe..0d9538543 100644 --- a/pyload/plugins/addons/ClickAndLoad.py +++ b/pyload/plugins/addons/ClickAndLoad.py @@ -21,10 +21,9 @@ import socket import thread -from module.plugins.Hook import Hook +from pyload.plugins.Addon import Addon - -class ClickAndLoad(Hook): +class ClickAndLoad(Addon): __name__ = "ClickAndLoad" __version__ = "0.22" __description__ = """Gives abillity to use jd's click and load. depends on webinterface""" @@ -36,15 +35,12 @@ class ClickAndLoad(Hook): def coreReady(self): self.port = int(self.config['webinterface']['port']) if self.config['webinterface']['activated']: - try: - if self.getConfig("extern"): - ip = "0.0.0.0" - else: - ip = "127.0.0.1" + if self.getConfig("extern"): + ip = "0.0.0.0" + else: + ip = "127.0.0.1" - thread.start_new_thread(proxy, (self, ip, self.port, 9666)) - except: - self.logError("ClickAndLoad port already in use.") + thread.start_new_thread(proxy, (self, ip, self.port, 9666)) def proxy(self, *settings): diff --git a/pyload/plugins/addons/ExternalScripts.py b/pyload/plugins/addons/ExternalScripts.py index b1a9420bb..2a95a7af0 100644 --- a/pyload/plugins/addons/ExternalScripts.py +++ b/pyload/plugins/addons/ExternalScripts.py @@ -20,13 +20,14 @@ import subprocess from os import listdir, access, X_OK, makedirs -from os.path import join, exists, basename +from os.path import join, exists, basename, abspath -from module.plugins.Hook import Hook -from module.utils import save_join +from pyload.plugins.Addon import Addon, AddEventListener +from pyload.utils.fs import safe_join -class ExternalScripts(Hook): + +class ExternalScripts(Addon): __name__ = "ExternalScripts" __version__ = "0.23" __description__ = """Run external scripts""" @@ -34,13 +35,12 @@ class ExternalScripts(Hook): __author_name__ = ("mkaay", "RaNaN", "spoob") __author_mail__ = ("mkaay@mkaay.de", "ranan@pyload.org", "spoob@pyload.org") - event_list = ["unrarFinished", "allDownloadsFinished", "allDownloadsProcessed"] - def setup(self): + def activate(self): self.scripts = {} folders = ['download_preparing', 'download_finished', 'package_finished', - 'before_reconnect', 'after_reconnect', 'unrar_finished', + 'before_reconnect', 'after_reconnect', 'extracting_finished', 'all_dls_finished', 'all_dls_processed'] for folder in folders: @@ -73,7 +73,7 @@ class ExternalScripts(Hook): def callScript(self, script, *args): try: cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] - self.logDebug("Executing %(script)s: %(cmd)s" % {"script": os.path.abspath(script), "cmd": " ".join(cmd)}) + self.logDebug("Executing %(script)s: %(cmd)s" % {"script": abspath(script), "cmd": " ".join(cmd)}) #output goes to pyload subprocess.Popen(cmd, bufsize=-1) except Exception, e: @@ -86,13 +86,13 @@ class ExternalScripts(Hook): def downloadFinished(self, pyfile): for script in self.scripts['download_finished']: self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, - save_join(self.config['general']['download_folder'], + safe_join(self.config['general']['download_folder'], pyfile.package().folder, pyfile.name), pyfile.id) def packageFinished(self, pypack): for script in self.scripts['package_finished']: folder = self.config['general']['download_folder'] - folder = save_join(folder, pypack.folder) + folder = safe_join(folder, pypack.folder) self.callScript(script, pypack.name, folder, pypack.password, pypack.id) @@ -104,14 +104,17 @@ class ExternalScripts(Hook): for script in self.scripts['after_reconnect']: self.callScript(script, ip) - def unrarFinished(self, folder, fname): - for script in self.scripts["unrar_finished"]: + @AddEventListener("extracting:finished") + def extractingFinished(self, folder, fname): + for script in self.scripts["extracting_finished"]: self.callScript(script, folder, fname) + @AddEventListener("download:allFinished") def allDownloadsFinished(self): for script in self.scripts["all_dls_finished"]: self.callScript(script) + @AddEventListener("download:allProcessed") def allDownloadsProcessed(self): for script in self.scripts["all_dls_processed"]: self.callScript(script) diff --git a/pyload/plugins/addons/ExtractArchive.py b/pyload/plugins/addons/ExtractArchive.py index 62c947f88..9a66f13c7 100644 --- a/pyload/plugins/addons/ExtractArchive.py +++ b/pyload/plugins/addons/ExtractArchive.py @@ -254,7 +254,7 @@ class ExtractArchive(Addon): self.logDebug("%s does not exists" % f) self.logInfo(basename(plugin.file), _("Extracting finished")) - self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file) + self.manager.dispatchEvent("extracting:finished", plugin.out, plugin.file) return plugin.getExtractedFiles() |