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

Transcoding supbprocess error handling

This commit is contained in:
spl0k 2013-10-20 17:27:20 +02:00
parent 45f60aaedb
commit 4c68bac189

View File

@ -60,11 +60,14 @@ def stream_media():
return request.error_formatter(0, 'No way to transcode from {} to {}'.format(src_suffix, dst_suffix)) return request.error_formatter(0, 'No way to transcode from {} to {}'.format(src_suffix, dst_suffix))
transcoder, decoder, encoder = map(lambda x: prepare_transcoding_cmdline(x, res.path, src_suffix, dst_suffix, dst_bitrate), [ transcoder, decoder, encoder ]) transcoder, decoder, encoder = map(lambda x: prepare_transcoding_cmdline(x, res.path, src_suffix, dst_suffix, dst_bitrate), [ transcoder, decoder, encoder ])
try:
if transcoder: if transcoder:
proc = subprocess.Popen(transcoder, stdout = subprocess.PIPE) proc = subprocess.Popen(transcoder, stdout = subprocess.PIPE)
else: else:
dec_proc = subprocess.Popen(decoder, stdout = subprocess.PIPE) dec_proc = subprocess.Popen(decoder, stdout = subprocess.PIPE)
proc = subprocess.Popen(encoder, stdin = dec_proc.stdout, stdout = subprocess.PIPE) proc = subprocess.Popen(encoder, stdin = dec_proc.stdout, stdout = subprocess.PIPE)
except:
return request.error_formatter(0, 'Error while running the transcoding process')
def transcode(): def transcode():
while True: while True: