From ff48437a15be9007886e76d308656247ac504662 Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 29 Aug 2016 17:52:19 +0200 Subject: [PATCH] Unicode used in other audiogens --- larigira/audiogen_randomdir.py | 2 +- larigira/audiogen_script.py | 2 ++ larigira/audiogen_static.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/larigira/audiogen_randomdir.py b/larigira/audiogen_randomdir.py index f4a10d4..40aeb31 100644 --- a/larigira/audiogen_randomdir.py +++ b/larigira/audiogen_randomdir.py @@ -46,4 +46,4 @@ def generate(spec): prefix='audiogen-randomdir-') os.close(tmp[0]) shutil.copy(path, tmp[1]) - yield 'file://' + tmp[1] + yield u'file://{}'.format(tmp[1]) diff --git a/larigira/audiogen_script.py b/larigira/audiogen_script.py index cf867d0..11afa60 100644 --- a/larigira/audiogen_script.py +++ b/larigira/audiogen_script.py @@ -10,6 +10,7 @@ security reasons). The script should assume a minimal environment, and being run from /. It must output one URI per line; please remember that URI must be understood from mpd, so file paths are not valid; file:///file/path.ogg is a valid URI instead. +The output MUST be UTF-8-encoded. Empty lines will be skipped. stderr will be logged, so please be careful. any non-zero exit code will result in no files being added.and an exception being logged. @@ -65,6 +66,7 @@ def generate(spec): (exc.returncode, spec['name'])) return [] + out = out.decode('utf-8') out = [p for p in out.split('\n') if p] logging.debug('Script %s produced %d files' % (spec['name'], len(out))) return out diff --git a/larigira/audiogen_static.py b/larigira/audiogen_static.py index 454f0b9..fb24c61 100644 --- a/larigira/audiogen_static.py +++ b/larigira/audiogen_static.py @@ -21,4 +21,4 @@ def generate(spec): prefix='audiogen-static-') os.close(tmp[0]) shutil.copy(path, tmp[1]) - yield 'file://' + tmp[1] + yield u'file://{}'.format(tmp[1])