diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-09-29 00:20:39 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-09-29 00:20:39 +0200 |
commit | 7ecc4aed5425ebde0ac997e90249f4f937040771 (patch) | |
tree | 8558ae88bb034e79b77a70fff5b64d485eba6206 /module/plugins/Hook.py | |
parent | reworked authorization, now works on api level (diff) | |
download | pyload-7ecc4aed5425ebde0ac997e90249f4f937040771.tar.xz |
new plugin Base class providing useful methods
Diffstat (limited to 'module/plugins/Hook.py')
-rw-r--r-- | module/plugins/Hook.py | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 85fb49190..fdcaccfe3 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -21,6 +21,8 @@ from thread import start_new_thread from traceback import print_exc +from Plugin import Base + class Expose(object): """ used for decoration to declare rpc services """ @@ -33,7 +35,7 @@ def threaded(f): return start_new_thread(f, args, kwargs) return run -class Hook(): +class Hook(Base): """ Base class for hook plugins. """ @@ -58,9 +60,7 @@ class Hook(): interval = 60 def __init__(self, core, manager): - self.core = core - self.log = core.log - self.config = core.config + Base.__init__(self, core) #: Provide information in dict here, usable by API `getInfo` self.info = None @@ -122,23 +122,6 @@ class Hook(): """ checks if hook is activated""" return self.config.getPlugin(self.__name__, "activated") - def getConfig(self, option): - """ gets config values """ - return self.config.getPlugin(self.__name__, option) - - def setConfig(self, option, value): - """ sets config value """ - self.config.setPlugin(self.__name__, option, value) - - #log functions - def logInfo(self, msg): - self.log.info("%s: %s" % (self.__name__, msg)) - def logWarning(self, msg): - self.log.warning("%s: %s" % (self.__name__, msg)) - def logError(self, msg): - self.log.error("%s: %s" % (self.__name__, msg)) - def logDebug(self, msg): - self.log.debug("%s: %s" % (self.__name__, msg)) #event methods - overwrite these if needed def coreReady(self): |