From: Guillaume Pellerin Date: Mon, 8 Dec 2014 15:05:31 +0000 (+0100) Subject: Goto 0.7 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8e1436acee3218be189e9392129df84a4851f041;p=deefuzzer.git Goto 0.7 Partially fixes #20 (bad chars on the icecast side...) --- diff --git a/deefuzzer/__init__.py b/deefuzzer/__init__.py index e1854b7..91d8d30 100644 --- a/deefuzzer/__init__.py +++ b/deefuzzer/__init__.py @@ -2,4 +2,4 @@ from core import * from station import * from tools import * -__version__ = '0.6.6' \ No newline at end of file +__version__ = '0.7' \ No newline at end of file diff --git a/deefuzzer/core.py b/deefuzzer/core.py index 9c7c37d..6ffaeb3 100644 --- a/deefuzzer/core.py +++ b/deefuzzer/core.py @@ -67,7 +67,7 @@ class DeeFuzzer(Thread): self.conf = get_conf_dict(self.conf_file) if not 'deefuzzer' in self.conf.keys(): - return + return # Get the log setting first (if possible) log_file = str(self.conf['deefuzzer'].pop('log', '')) @@ -114,13 +114,13 @@ class DeeFuzzer(Thread): self.logqueue.put(obj) except: pass - + def _info(self, msg): self._log('info', msg) - + def _err(self, msg): self._log('err', msg) - + def set_m3u_playlist(self): m3u_dir = os.sep.join(self.m3u.split(os.sep)[:-1]) if not os.path.exists(m3u_dir) and m3u_dir: @@ -146,11 +146,11 @@ class DeeFuzzer(Thread): if not 'livecreation' in options.keys(): # We have no folder specified. Bail. return - + if int(options['livecreation']) == 0: # Livecreation not specified. Bail. return - + folder = str(options['folder']) if not os.path.isdir(folder): # The specified path is not a folder. Bail. @@ -179,7 +179,7 @@ class DeeFuzzer(Thread): except: pass return True - + def create_station(self, folder, options): """Create a station definition for a folder given the specified options.""" @@ -210,7 +210,7 @@ class DeeFuzzer(Thread): # We have a file specified. Load just that file. self.load_station_config(folder) return - + if not os.path.isdir(folder): # Whatever we have, it's not either a file or folder. Bail. return @@ -287,12 +287,14 @@ class DeeFuzzer(Thread): self._err('Error validating station ' + name) except Exception: self._err('Error starting station ' + name) + raise continue + ns = ns_new if self.m3u: self.set_m3u_playlist() - + for i in self.station_instances.keys(): try: if not self.station_instances[i].isAlive(): @@ -300,7 +302,7 @@ class DeeFuzzer(Thread): self._info('Restarted crashed station ' + i) except: pass - + self.mainLoop = True time.sleep(5) # end main loop diff --git a/deefuzzer/station.py b/deefuzzer/station.py index a3eda3c..ed87d17 100644 --- a/deefuzzer/station.py +++ b/deefuzzer/station.py @@ -760,7 +760,7 @@ class Station(Thread): return True except Exception, e: - self_err('icecastloop_nextmedia: Error: ' + str(e)) + self._err('icecastloop_nextmedia: Error: ' + str(e)) return False def icecastloop_metadata(self): diff --git a/deefuzzer/tools/utils.py b/deefuzzer/tools/utils.py index f8d4072..43886cf 100644 --- a/deefuzzer/tools/utils.py +++ b/deefuzzer/tools/utils.py @@ -87,6 +87,9 @@ def get_conf_dict(file): return xmltodict(data,'utf-8') elif 'yaml' in mime_type: import yaml + def custom_str_constructor(loader, node): + return loader.construct_scalar(node).encode('utf-8') + yaml.add_constructor(u'tag:yaml.org,2002:str', custom_str_constructor) confile = open(file,'r') data = confile.read() confile.close() @@ -97,7 +100,7 @@ def get_conf_dict(file): data = confile.read() confile.close() return json.loads(data) - + return False def folder_contains_music(folder): diff --git a/setup.py b/setup.py index 0d3c0ec..56cccad 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( long_description = open('README.rst').read(), author = "Guillaume Pellerin", author_email = "yomguy@parisson.com", - version = '0.6.6', + version = '0.7', install_requires = [ 'setuptools', 'python-shout',