diff --git a/boswatch.py b/boswatch.py index 2768a5e..90dabc8 100755 --- a/boswatch.py +++ b/boswatch.py @@ -131,8 +131,8 @@ try: else: #load plugins - from includes import pluginloader - pluginloader.loadPlugins() + from includes import pluginLoader + pluginLoader.loadPlugins() try: #start rtl_fm diff --git a/includes/alarmHandler.py b/includes/alarmHandler.py index 88a1834..8890ee4 100644 --- a/includes/alarmHandler.py +++ b/includes/alarmHandler.py @@ -4,11 +4,11 @@ import logging from includes import globals # Global variables -from includes import pluginloader def processAlarm(typ,freq,data): logging.debug("[ ALARM ]") for name, plugin in globals.pluginList.items(): logging.debug("call Plugin: %s", name) plugin.run(typ,freq,data) + logging.debug("return from: %s", name) logging.debug("[END ALARM]") \ No newline at end of file diff --git a/includes/pluginloader.py b/includes/pluginLoader.py similarity index 100% rename from includes/pluginloader.py rename to includes/pluginLoader.py diff --git a/plugin_test.py b/plugin_test.py index 49c6308..4981052 100644 --- a/plugin_test.py +++ b/plugin_test.py @@ -12,7 +12,8 @@ import os #for log mkdir import time #timestamp for doublealarm from includes import globals # Global variables -from includes import pluginloader +from includes import pluginLoader +from includes import alarmHandler #create new logger logger = logging.getLogger() @@ -49,15 +50,7 @@ except: logging.exception("cannot read config file") -try: - logging.debug("loading plugins") - pluginList = {} - for i in pluginloader.getPlugins(): - plugin = pluginloader.loadPlugin(i) - pluginList[i["name"]] = plugin - logging.debug("loading ready") -except: - logging.exception("cannot load Plugins") +pluginLoader.loadPlugins() # ----- Test Data ----- # @@ -75,11 +68,7 @@ while True: time.sleep(1) print "" - logging.debug("[ ALARM ]") - for name, plugin in pluginList.items(): - logging.debug("call Plugin: %s", name) - plugin.run(typ,"0",data) - logging.debug("[END ALARM]") + alarmHandler.processAlarm(typ,"0",data) except KeyboardInterrupt: logging.warning("Keyboard Interrupt") diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index 0720db7..689c4bc 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -68,7 +68,7 @@ def run(typ,freq,data): logging.exception("cannot get HTTP response") finally: - logging.debug("close http-Connection") + logging.debug("close HTTP-Connection") httprequest.close() ########## User Plugin CODE ##########