1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-23 01:16:18 +00:00

Improved transcoding configuration parsing

This commit is contained in:
spl0k 2018-03-11 21:29:17 +01:00
parent efbe0d4a4b
commit e5d9050fa7

View File

@ -11,6 +11,7 @@ import codecs
import mimetypes import mimetypes
import os.path import os.path
import requests import requests
import shlex
import subprocess import subprocess
from flask import request, Response, send_file from flask import request, Response, send_file
@ -28,7 +29,7 @@ from .exceptions import GenericError, MissingParameter, NotFound, ServerError, U
def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_format, output_bitrate): def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_format, output_bitrate):
if not base_cmdline: if not base_cmdline:
return None return None
ret = base_cmdline.split() ret = shlex.split(base_cmdline)
ret = [ ret = [
part.replace('%srcpath', input_file).replace('%srcfmt', input_format).replace('%outfmt', output_format).replace('%outrate', str(output_bitrate)) part.replace('%srcpath', input_file).replace('%srcfmt', input_format).replace('%outfmt', output_format).replace('%outrate', str(output_bitrate))
for part in ret for part in ret