From: marcelveldt Date: Wed, 16 Oct 2019 21:15:40 +0000 (+0200) Subject: Update http_streamer.py X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=12254d41f568e084181841f6190eb3f26d0e94b5;p=music-assistant-server.git Update http_streamer.py make sure that tempfiles are cleaned up --- diff --git a/music_assistant/http_streamer.py b/music_assistant/http_streamer.py index ad6dd0e4..4db3aae2 100755 --- a/music_assistant/http_streamer.py +++ b/music_assistant/http_streamer.py @@ -404,6 +404,7 @@ class HTTPStreamer(): args = 'sox --ignore-length -t %s - -t %s %s fade t %s' % (pcm_args, pcm_args, fadeinfile.name, fade_length) process = subprocess.Popen(args, shell=True, stdin=subprocess.PIPE) process.communicate(fade_in_part) + fadeinfile.close() # create fade-out part fadeoutfile = MemoryTempfile(fallback=True).NamedTemporaryFile(buffering=0) args = 'sox --ignore-length -t %s - -t %s %s reverse fade t %s reverse' % (pcm_args, pcm_args, fadeoutfile.name, fade_length) @@ -417,4 +418,6 @@ class HTTPStreamer(): stdout=subprocess.PIPE, stdin=subprocess.PIPE) crossfade_part, stderr = process.communicate() LOGGER.debug("Got %s bytes in memory for crossfade_part after sox" % len(crossfade_part)) + fadeinfile.close() + fadeoutfile.close() return crossfade_part