From 3aaf7b415238ae044719e258ee5664975e2bdd0f Mon Sep 17 00:00:00 2001 From: achbed Date: Fri, 12 Dec 2014 16:19:03 -0600 Subject: [PATCH] BUG: a few logging functions were called incorrectly in station.py FEATURE: Added option (ignoreerrors) to log and continue when an error occurs during station setup --- deefuzzer/core.py | 8 +++++++- deefuzzer/station.py | 6 +++--- example/deefuzzer_doc.xml | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deefuzzer/core.py b/deefuzzer/core.py index 6ffaeb3..1b88bba 100644 --- a/deefuzzer/core.py +++ b/deefuzzer/core.py @@ -60,6 +60,7 @@ class DeeFuzzer(Thread): watchfolder = {} logqueue = Queue.Queue() mainLoop = False + ignoreErrors = False def __init__(self, conf_file): Thread.__init__(self) @@ -81,6 +82,10 @@ class DeeFuzzer(Thread): if key == 'm3u': self.m3u = str(self.conf['deefuzzer'][key]) + elif key == 'ignoreerrors': + # Load station definitions from the main config file + self.ignoreErrors = bool(self.conf['deefuzzer'][key]) + elif key == 'station': # Load station definitions from the main config file if not isinstance(self.conf['deefuzzer'][key], list): @@ -287,7 +292,8 @@ class DeeFuzzer(Thread): self._err('Error validating station ' + name) except Exception: self._err('Error starting station ' + name) - raise + if not ignoreErrors: + raise continue ns = ns_new diff --git a/deefuzzer/station.py b/deefuzzer/station.py index ed87d17..80e0c95 100644 --- a/deefuzzer/station.py +++ b/deefuzzer/station.py @@ -718,8 +718,8 @@ class Station(Thread): self.channelIsOpen = True return True except: - self.err('channel could not be opened') - + self._err('channel could not be opened') + return False def channel_close(self): @@ -771,7 +771,7 @@ class Station(Thread): self.channel.set_metadata({'song': self.song, 'charset': 'utf-8'}) return True except Exception, e: - self_err('icecastloop_metadata: Error: ' + str(e)) + self._err('icecastloop_metadata: Error: ' + str(e)) return False def run(self): diff --git a/example/deefuzzer_doc.xml b/example/deefuzzer_doc.xml index 6a3dba3..bf314e6 100644 --- a/example/deefuzzer_doc.xml +++ b/example/deefuzzer_doc.xml @@ -1,10 +1,16 @@ + /path/to/station.log /path/to/station.m3u + + 0