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])