]> git.parisson.com Git - deefuzzer.git/commitdiff
BUG: a few logging functions were called incorrectly in station.py
authorachbed <github@achbed.org>
Fri, 12 Dec 2014 22:19:03 +0000 (16:19 -0600)
committerachbed <github@achbed.org>
Fri, 12 Dec 2014 22:19:03 +0000 (16:19 -0600)
FEATURE: Added option (ignoreerrors) to log and continue when an error occurs during station setup

deefuzzer/core.py
deefuzzer/station.py
example/deefuzzer_doc.xml

index 6ffaeb39c0dca4e50d0d569c7fbb97fb918cd95b..1b88bba93260975fa49692433390bc65922a736c 100644 (file)
@@ -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
index ed87d17a1eba642593dcbc89036df47dfb689b1f..80e0c958bb4d95d6e5ddccac2fcb8a2c501a6698 100644 (file)
@@ -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):
index 6a3dba32c66fb63fae562390c7e1e76285c38908..bf314e602274fe0cf39e1c53e41d453f4493eb18 100644 (file)
@@ -1,10 +1,16 @@
 <deefuzzer>
+    <!-- A quick note about XML configuration files - they cannot have empty values.  For 
+          example, <tag></tag> is invalid, while <tag> </tag> is valid (single space as a 
+          value).  An empty tag will crash the entire application.  You have been warned.  -->
     <!-- A path to the log file (need write access rights to the directory) -->
     <log>/path/to/station.log</log>
     <!-- A path to the M3U playlist file (need write access rights to the directory).
          The file is preferably accessible behind an url,
          for example, http://mydomain.com/m3u/mystation.m3u -->
     <m3u>/path/to/station.m3u</m3u>
+    <!-- Whether or not to skip stations that fail instead of dying completely.  0 will raise
+          all errors and report them to the console, 1 will log the error and continue.  -->
+    <ignoreerrors>0</ignoreerrors>
     <stationdefaults>
       <!-- This tag allows a common default configuration to be set for all stations.  This
            is useful when defining many stations that will share many common configuration