From 89acc0ff595f73956572c8892ccb860c06fba33a Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 4 Jan 2010 20:35:26 +0100 Subject: added hook system --- module/plugins/hooks/ContainerDownload.py | 42 +++++++++++++++++++++++++ module/plugins/hooks/Hook.py | 51 +++++++++++++++++++++++++++++++ module/plugins/hooks/__init__.py | 1 + 3 files changed, 94 insertions(+) create mode 100644 module/plugins/hooks/ContainerDownload.py create mode 100644 module/plugins/hooks/Hook.py create mode 100644 module/plugins/hooks/__init__.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py new file mode 100644 index 000000000..d031cdf69 --- /dev/null +++ b/module/plugins/hooks/ContainerDownload.py @@ -0,0 +1,42 @@ +# -*- 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 + @interface-version: 0.1 +""" + +from module.plugins.hooks.Hook import Hook + +from os.path import join, abspath + +class ContainerDownload(Hook): + def __init__(self, core): + Hook.__init__(self, core) + props = {} + props['name'] = "ContainerDownload" + props['version'] = "0.1" + props['description'] = """add the downloaded container to current package""" + props['author_name'] = ("mkaay") + props['author_mail'] = ("mkaay@mkaay.de") + self.props = props + + def downloadFinished(self, pyfile): + filename = pyfile.status.filename + if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): + self.logger.info("ContainerDownload hook: adding container file") + location = abspath(join(pyfile.folder, filename)) + newFile = self.core.file_list.collector.addLink(location) + self.core.file_list.packager.addFileToPackage(pyfile.package.data["id"], self.core.file_list.collector.popFile(newFile)) diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py new file mode 100644 index 000000000..f02432718 --- /dev/null +++ b/module/plugins/hooks/Hook.py @@ -0,0 +1,51 @@ +# -*- 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 + @interface-version: 0.1 +""" + +import logging + +class Hook(): + def __init__(self, core): + self.logger = logging.getLogger("log") + props = {} + props['name'] = "Hook" + props['version'] = "0.1" + props['description'] = """interface for hook""" + props['author_name'] = ("mkaay") + props['author_mail'] = ("mkaay@mkaay.de") + self.props = props + self.core = core + + def downloadStarts(self, pyfile): + pass + + def downloadFinished(self, pyfile): + pass + + def packageFinished(self, pypack): + """ + not implemented! + """ + pass + + def beforeReconnecting(self, ip): + pass + + def afterReconnecting(self, ip): + pass diff --git a/module/plugins/hooks/__init__.py b/module/plugins/hooks/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/module/plugins/hooks/__init__.py @@ -0,0 +1 @@ + -- cgit v1.2.3 From d2aa3fceb9f896343b128d40f20a0465cf69efca Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 6 Jan 2010 22:11:24 +0100 Subject: small fixes, new hook stuff --- module/plugins/hooks/ContainerDownload.py | 2 ++ module/plugins/hooks/Hook.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index d031cdf69..417b42ee8 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -35,6 +35,8 @@ class ContainerDownload(Hook): def downloadFinished(self, pyfile): filename = pyfile.status.filename + if not pyfile.url.startswith("http"): + return if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): self.logger.info("ContainerDownload hook: adding container file") location = abspath(join(pyfile.folder, filename)) diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py index f02432718..09b21ba49 100644 --- a/module/plugins/hooks/Hook.py +++ b/module/plugins/hooks/Hook.py @@ -19,10 +19,15 @@ """ import logging +from os.path import join + +from module.XMLConfigParser import XMLConfigParser class Hook(): def __init__(self, core): self.logger = logging.getLogger("log") + self.configParser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml")) + self.config = {} props = {} props['name'] = "Hook" props['version'] = "0.1" @@ -32,6 +37,17 @@ class Hook(): self.props = props self.core = core + def readConfig(self): + self.configParser.loadData() + section = self.props['name'] + try: + self.config = self.configParser.getConfig()[section] + except: + self.setup() + + def setup(self): + pass + def downloadStarts(self, pyfile): pass -- cgit v1.2.3 From 1896a9faec5871f8051a8dfa407883cef46bb6df Mon Sep 17 00:00:00 2001 From: spoob Date: Thu, 7 Jan 2010 15:59:23 +0100 Subject: Better Rapidshare Slot Check thanks #66 --- module/plugins/hooks/ContainerDownload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index 417b42ee8..c13a7f622 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -38,7 +38,7 @@ class ContainerDownload(Hook): if not pyfile.url.startswith("http"): return if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): - self.logger.info("ContainerDownload hook: adding container file") + self.logger.info("ContainerDownload: adding container file") location = abspath(join(pyfile.folder, filename)) newFile = self.core.file_list.collector.addLink(location) self.core.file_list.packager.addFileToPackage(pyfile.package.data["id"], self.core.file_list.collector.popFile(newFile)) -- cgit v1.2.3 From 205c200b94f3b4edf1220a9ffd5ebeab58aa098b Mon Sep 17 00:00:00 2001 From: spoob Date: Thu, 7 Jan 2010 19:05:42 +0100 Subject: Better ConfigParser --- module/plugins/hooks/Hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py index 09b21ba49..739af3200 100644 --- a/module/plugins/hooks/Hook.py +++ b/module/plugins/hooks/Hook.py @@ -26,7 +26,7 @@ from module.XMLConfigParser import XMLConfigParser class Hook(): def __init__(self, core): self.logger = logging.getLogger("log") - self.configParser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml")) + self.configParser = XMLConfigParser(join("module","config","plugin.xml")) self.config = {} props = {} props['name'] = "Hook" -- cgit v1.2.3 From ad532495edc4103129bf86b53dec81038babe063 Mon Sep 17 00:00:00 2001 From: spoob Date: Sat, 9 Jan 2010 22:05:15 +0100 Subject: Hooks Config Incomplete --- module/plugins/hooks/Hook.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py index 739af3200..4b5f6751f 100644 --- a/module/plugins/hooks/Hook.py +++ b/module/plugins/hooks/Hook.py @@ -40,10 +40,10 @@ class Hook(): def readConfig(self): self.configParser.loadData() section = self.props['name'] - try: - self.config = self.configParser.getConfig()[section] - except: - self.setup() + #~ try: + #~ self.config = self.configParser.getConfig()[section] + #~ except: + #~ self.setup() def setup(self): pass -- cgit v1.2.3 From 5274c296dc13cf91df804a537b8e2109d62b3d98 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sat, 9 Jan 2010 22:22:07 +0100 Subject: better hook config --- module/plugins/hooks/Hook.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py index 4b5f6751f..1a7fba092 100644 --- a/module/plugins/hooks/Hook.py +++ b/module/plugins/hooks/Hook.py @@ -40,13 +40,17 @@ class Hook(): def readConfig(self): self.configParser.loadData() section = self.props['name'] - #~ try: - #~ self.config = self.configParser.getConfig()[section] - #~ except: - #~ self.setup() + try: + self.config = self.configParser.getConfig()[section] + except: + self.setup() def setup(self): - pass + self.configParser.set(self.props["name"], {"option": "activated", "type": "bool", "name": "Activated"}, True) + self.readConfig() + + def isActivated(self): + return self.config["activated"] def downloadStarts(self, pyfile): pass -- cgit v1.2.3 From a1c1d16ab515373c6111724393a0b242e9bf32a4 Mon Sep 17 00:00:00 2001 From: spoob Date: Sun, 10 Jan 2010 03:22:04 +0100 Subject: dont import deactivated hooks --- module/plugins/hooks/ContainerDownload.py | 2 +- module/plugins/hooks/__init__.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index c13a7f622..f520b705c 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -18,7 +18,7 @@ @interface-version: 0.1 """ -from module.plugins.hooks.Hook import Hook +from module.plugins.Hook import Hook from os.path import join, abspath diff --git a/module/plugins/hooks/__init__.py b/module/plugins/hooks/__init__.py index 8b1378917..e69de29bb 100644 --- a/module/plugins/hooks/__init__.py +++ b/module/plugins/hooks/__init__.py @@ -1 +0,0 @@ - -- cgit v1.2.3 From 3b9a34f69cfe6e0fe869b3649e24d5c69c321cee Mon Sep 17 00:00:00 2001 From: spoob Date: Sun, 10 Jan 2010 03:23:41 +0100 Subject: added youtube to mp3 converter --- module/plugins/hooks/Mp3Convert.py | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 module/plugins/hooks/Mp3Convert.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Mp3Convert.py b/module/plugins/hooks/Mp3Convert.py new file mode 100644 index 000000000..d70bb93f6 --- /dev/null +++ b/module/plugins/hooks/Mp3Convert.py @@ -0,0 +1,50 @@ +# -*- 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 + @interface-version: 0.1 +""" + +from module.plugins.Hook import Hook +from os.path import join, abspath +import subprocess +from os import remove + +class Mp3Convert(Hook): + def __init__(self, core): + Hook.__init__(self, core) + props = {} + props['name'] = "Mp3Convert" + props['version'] = "0.1" + props['description'] = """converts files like videos to mp3""" + props['author_name'] = ("spoob") + props['author_mail'] = ("spoob@pyload.org") + self.props = props + self.readConfig() + + def downloadFinished(self, pyfile): + plugin = pyfile.plugin.props['name'] + if plugin == "YoutubeCom": + filename = pyfile.status.filename[:-4] + cmd = ['ffmpeg -i "%s" -vn -ar 44100 -ac 2 -ab 192k "%s.mp3"' % (abspath(join(pyfile.folder, pyfile.status.filename)), abspath(join(pyfile.folder, filename)))] + converter = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + converter.wait() + if self.config["removeRegularFile"]: + remove(abspath(join(pyfile.folder, pyfile.status.filename))) + self.logger.info("Mp3Convert: Converterd %s to Mp3" % filename) + + def setup(self): + self.configParser.set(self.props["name"], {"option": "removeRegularFile", "type": "bool", "name": "Remove Regular Files"}, False) -- cgit v1.2.3 From 82fd9d8f649630000d69b559caa00ce9db8382a9 Mon Sep 17 00:00:00 2001 From: spoob Date: Sun, 10 Jan 2010 03:26:08 +0100 Subject: moved Hooks.py --- module/plugins/hooks/Hook.py | 71 -------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 module/plugins/hooks/Hook.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py deleted file mode 100644 index 1a7fba092..000000000 --- a/module/plugins/hooks/Hook.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- 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 - @interface-version: 0.1 -""" - -import logging -from os.path import join - -from module.XMLConfigParser import XMLConfigParser - -class Hook(): - def __init__(self, core): - self.logger = logging.getLogger("log") - self.configParser = XMLConfigParser(join("module","config","plugin.xml")) - self.config = {} - props = {} - props['name'] = "Hook" - props['version'] = "0.1" - props['description'] = """interface for hook""" - props['author_name'] = ("mkaay") - props['author_mail'] = ("mkaay@mkaay.de") - self.props = props - self.core = core - - def readConfig(self): - self.configParser.loadData() - section = self.props['name'] - try: - self.config = self.configParser.getConfig()[section] - except: - self.setup() - - def setup(self): - self.configParser.set(self.props["name"], {"option": "activated", "type": "bool", "name": "Activated"}, True) - self.readConfig() - - def isActivated(self): - return self.config["activated"] - - def downloadStarts(self, pyfile): - pass - - def downloadFinished(self, pyfile): - pass - - def packageFinished(self, pypack): - """ - not implemented! - """ - pass - - def beforeReconnecting(self, ip): - pass - - def afterReconnecting(self, ip): - pass -- cgit v1.2.3 From 5448bace91d93bd499e89d9ca5496321b4dc816c Mon Sep 17 00:00:00 2001 From: mkaay Date: Sun, 10 Jan 2010 21:29:01 +0100 Subject: fixed mp3convert --- module/plugins/hooks/Mp3Convert.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Mp3Convert.py b/module/plugins/hooks/Mp3Convert.py index d70bb93f6..6f32eecf4 100644 --- a/module/plugins/hooks/Mp3Convert.py +++ b/module/plugins/hooks/Mp3Convert.py @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - @author: mkaay + @author: mkaaym spoob @interface-version: 0.1 """ @@ -30,8 +30,8 @@ class Mp3Convert(Hook): props['name'] = "Mp3Convert" props['version'] = "0.1" props['description'] = """converts files like videos to mp3""" - props['author_name'] = ("spoob") - props['author_mail'] = ("spoob@pyload.org") + props['author_name'] = ("spoob", "mkaay") + props['author_mail'] = ("spoob@pyload.org", "mkaay@mkaay.de") self.props = props self.readConfig() @@ -48,3 +48,4 @@ class Mp3Convert(Hook): def setup(self): self.configParser.set(self.props["name"], {"option": "removeRegularFile", "type": "bool", "name": "Remove Regular Files"}, False) + Hook.setup(self) -- cgit v1.2.3 From 324ed3da96b07d42da753d1314495724ef4c2b7a Mon Sep 17 00:00:00 2001 From: spoob Date: Wed, 13 Jan 2010 11:18:03 +0100 Subject: removed Mp3Convert, just load plugin config once --- module/plugins/hooks/Mp3Convert.py | 51 -------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 module/plugins/hooks/Mp3Convert.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Mp3Convert.py b/module/plugins/hooks/Mp3Convert.py deleted file mode 100644 index 6f32eecf4..000000000 --- a/module/plugins/hooks/Mp3Convert.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- 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: mkaaym spoob - @interface-version: 0.1 -""" - -from module.plugins.Hook import Hook -from os.path import join, abspath -import subprocess -from os import remove - -class Mp3Convert(Hook): - def __init__(self, core): - Hook.__init__(self, core) - props = {} - props['name'] = "Mp3Convert" - props['version'] = "0.1" - props['description'] = """converts files like videos to mp3""" - props['author_name'] = ("spoob", "mkaay") - props['author_mail'] = ("spoob@pyload.org", "mkaay@mkaay.de") - self.props = props - self.readConfig() - - def downloadFinished(self, pyfile): - plugin = pyfile.plugin.props['name'] - if plugin == "YoutubeCom": - filename = pyfile.status.filename[:-4] - cmd = ['ffmpeg -i "%s" -vn -ar 44100 -ac 2 -ab 192k "%s.mp3"' % (abspath(join(pyfile.folder, pyfile.status.filename)), abspath(join(pyfile.folder, filename)))] - converter = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - converter.wait() - if self.config["removeRegularFile"]: - remove(abspath(join(pyfile.folder, pyfile.status.filename))) - self.logger.info("Mp3Convert: Converterd %s to Mp3" % filename) - - def setup(self): - self.configParser.set(self.props["name"], {"option": "removeRegularFile", "type": "bool", "name": "Remove Regular Files"}, False) - Hook.setup(self) -- cgit v1.2.3 From ce184310fd592047d47de24287b20fee00a587cd Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 27 Jan 2010 14:52:42 +0100 Subject: moved script support to a new plugin --- module/plugins/hooks/ExternalScripts.py | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 module/plugins/hooks/ExternalScripts.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py new file mode 100644 index 000000000..004ba07cc --- /dev/null +++ b/module/plugins/hooks/ExternalScripts.py @@ -0,0 +1,100 @@ +# -*- 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 + @interface-version: 0.1 +""" + +from module.plugins.hooks.Hook import Hook +import subprocess +from os import listdir, sep +from os.path import join + +class ExternalScripts(Hook): + def __init__(self, core): + Hook.__init__(self, core) + props = {} + props['name'] = "ExternalScripts" + props['version'] = "0.1" + props['description'] = """run external scripts""" + props['author_name'] = ("mkaay", "RaNaN", "spoob") + props['author_mail'] = ("mkaay@mkaay.de", "ranan@pyload.org", "spoob@pyload.org") + self.props = props + self.core = core + self.scripts = {} + + script_folders = ['scripts'+sep+'download_preparing'+sep, + 'scripts'+sep+'download_finished'+sep, + 'scripts'+sep+'package_finished'+sep, + 'scripts'+sep+'before_reconnect'+sep, + 'scripts'+sep+'after_reconnect'+sep] + self.core.check_file(script_folders, _("folders for scripts"), True) + + f = lambda x: False if x.startswith("#") or x.endswith("~") else True + self.scripts = {} + + folder = join(self.core.path, "scripts") + + self.scripts['download_preparing'] = filter(f, listdir(join(folder, 'download_preparing'))) + self.scripts['download_finished'] = filter(f, listdir(join(folder, 'download_finished'))) + self.scripts['package_finished'] = filter(f, listdir(join(folder, 'package_finished'))) + self.scripts['before_reconnect'] = filter(f, listdir(join(folder, 'before_reconnect'))) + self.scripts['after_reconnect'] = filter(f, listdir(join(folder, 'after_reconnect'))) + + for script_type, script_name in self.scripts.iteritems(): + if script_name != []: + self.logger.info("Installed %s Scripts: %s" % (script_type, ", ".join(script_name))) + + #~ self.core.logger.info("Installed Scripts: %s" % str(self.scripts)) + + self.folder = folder + + def downloadStarts(self, pyfile): + for script in self.scripts['download_preparing']: + try: + out = subprocess.Popen([join(self.folder, 'download_preparing', script), pyfile.plugin.props['name'], pyfile.url], stdout=subprocess.PIPE) + out.wait() + except: + pass + + def downloadFinished(self, pyfile): + for script in self.scripts['download_finished']: + try: + out = subprocess.Popen([join(self.folder, 'download_finished', script), pyfile.plugin.props['name'], pyfile.url, pyfile.status.name, \ + join(self.core.path,self.core.config['general']['download_folder'], pyfile.folder, pyfile.status.name)], stdout=subprocess.PIPE) + except: + pass + + def packageFinished(self, pypack): + """ + not implemented! + """ + pass + + def beforeReconnecting(self, ip): + for script in self.scripts['before_reconnect']: + try: + out = subprocess.Popen([join(self.folder, 'before_reconnect', script), ip], stdout=subprocess.PIPE) + out.wait() + except: + pass + + def afterReconnecting(self, ip): + for script in self.scripts['after_reconnect']: + try: + out = subprocess.Popen([join(self.folder, 'download_preparing', script), ip], stdout=subprocess.PIPE) + except: + pass -- cgit v1.2.3 From c3deb9779303e8300203650e4b44bf340f7c14c7 Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 27 Jan 2010 18:12:06 +0100 Subject: fix --- module/plugins/hooks/ExternalScripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 004ba07cc..30bd43770 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -18,7 +18,7 @@ @interface-version: 0.1 """ -from module.plugins.hooks.Hook import Hook +from module.plugins.Hook import Hook import subprocess from os import listdir, sep from os.path import join -- cgit v1.2.3