From 82a837c19e73ea37117d7f72a967857e0b1bf8c6 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 22 May 2015 21:27:46 +0200 Subject: [PATCH] move loadPlugins() pHanlder->pLoader --- boswatch.py | 4 ++-- includes/pluginHandler.py | 14 +------------- includes/pluginloader.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/boswatch.py b/boswatch.py index 678e37f..2768a5e 100755 --- a/boswatch.py +++ b/boswatch.py @@ -131,8 +131,8 @@ try: else: #load plugins - from includes import pluginHandler - pluginHandler.loadPlugins() + from includes import pluginloader + pluginloader.loadPlugins() try: #start rtl_fm diff --git a/includes/pluginHandler.py b/includes/pluginHandler.py index eadbd08..b3491e1 100644 --- a/includes/pluginHandler.py +++ b/includes/pluginHandler.py @@ -11,16 +11,4 @@ def throwAlarm(typ,freq,data): for name, plugin in globals.pluginList.items(): logging.debug("call Plugin: %s", name) plugin.run(typ,freq,data) - logging.debug("[END ALARM]") - - -def loadPlugins(): - try: - #load plugins - logging.debug("loading plugins") - for i in pluginloader.getPlugins(): - plugin = pluginloader.loadPlugin(i) - globals.pluginList[i["name"]] = plugin - - except: - logging.exception("cannot load Plugins") \ No newline at end of file + logging.debug("[END ALARM]") \ No newline at end of file diff --git a/includes/pluginloader.py b/includes/pluginloader.py index 25c66ad..ae591cf 100644 --- a/includes/pluginloader.py +++ b/includes/pluginloader.py @@ -7,6 +7,15 @@ import os from includes import globals # Global variables +def loadPlugins(): + try: + logging.debug("loading plugins") + for i in getPlugins(): + plugin = loadPlugin(i) + globals.pluginList[i["name"]] = plugin + except: + logging.exception("cannot load Plugins") + def getPlugins(): try: @@ -34,6 +43,7 @@ def getPlugins(): return plugins + def loadPlugin(plugin): try: logging.debug("load Plugin: %s", plugin["name"])