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/Hook.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 module/plugins/Hook.py (limited to 'module/plugins/Hook.py') diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py new file mode 100644 index 000000000..2d8ed0741 --- /dev/null +++ b/module/plugins/Hook.py @@ -0,0 +1,70 @@ +# -*- 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): + pass + + 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 f7d85633be5b0d470fefd0c2dbb92454b80e0c2f Mon Sep 17 00:00:00 2001 From: mkaay Date: Sun, 10 Jan 2010 21:36:49 +0100 Subject: edited wrong file in last commit --- module/plugins/Hook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/Hook.py') diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 2d8ed0741..1a7fba092 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -46,7 +46,8 @@ class Hook(): 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"] -- 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/Hook.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'module/plugins/Hook.py') 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) -- cgit v1.2.3 From 3be34eb4b5b286f02de780ce34a7691d49c7a384 Mon Sep 17 00:00:00 2001 From: spoob Date: Wed, 13 Jan 2010 11:21:11 +0100 Subject: forgot changes --- module/plugins/Hook.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins/Hook.py') diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 366cde185..6f8a48802 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -40,7 +40,10 @@ class Hook(): def readConfig(self): self.configParser.loadData() section = self.props['name'] - self.config = self.configParser.getConfig()[section] + 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) -- cgit v1.2.3 From 4eb1404eca2b795d809ee626a057a543043060cb Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 21 Jan 2010 22:13:21 +0100 Subject: some optimizations --- module/plugins/Hook.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/Hook.py') diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 6f8a48802..541d0c2e9 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -19,9 +19,7 @@ """ import logging -from os.path import join -from module.XMLConfigParser import XMLConfigParser class Hook(): def __init__(self, core): -- cgit v1.2.3