diff options
-rw-r--r-- | module/Plugin.py | 2 | ||||
-rw-r--r-- | module/plugins/Hook.py | 7 | ||||
-rw-r--r-- | module/plugins/hooks/Mp3Convert.py | 51 | ||||
-rwxr-xr-x | pyLoadCore.py | 2 |
4 files changed, 5 insertions, 57 deletions
diff --git a/module/Plugin.py b/module/Plugin.py index 45371c3af..2e61a1b55 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -31,7 +31,7 @@ from module.download_thread import CaptchaError class Plugin(): def __init__(self, parent): - self.configparser = XMLConfigParser(join("module","config","plugin.xml")) + self.configparser = parent.core.parser_plugins self.config = {} props = {} props['name'] = "BasePlugin" diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 1a7fba092..366cde185 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/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")) + self.configParser = core.parser_plugins self.config = {} props = {} props['name'] = "Hook" @@ -40,10 +40,7 @@ class Hook(): def readConfig(self): self.configParser.loadData() section = self.props['name'] - try: - self.config = self.configParser.getConfig()[section] - except: - self.setup() + self.config = self.configParser.getConfig()[section] def setup(self): self.configParser.set(self.props["name"], {"option": "activated", "type": "bool", "name": "Activated"}, True) 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 <http://www.gnu.org/licenses/>. - - @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) diff --git a/pyLoadCore.py b/pyLoadCore.py index 5ae81294d..b3f9b9186 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -86,6 +86,8 @@ class Core(object): self.xmlconfig = XMLConfigParser(join(self.path, "module", "config", "core.xml"))
self.config = self.xmlconfig.getConfig()
+ self.parser_plugins = XMLConfigParser(join(self.path, "module", "config", "plugin.xml"))
+ #~ self.config_plugins = self.parser_plugins.getConfig()
self.do_kill = False
self.do_restart = False
|