From 12254d41f568e084181841f6190eb3f26d0e94b5 Mon Sep 17 00:00:00 2001 From: marcelveldt Date: Wed, 16 Oct 2019 23:15:40 +0200 Subject: [PATCH] Update http_streamer.py make sure that tempfiles are cleaned up --- music_assistant/http_streamer.py | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.34.1