From b38949d0da619a0ce208e2395edaf5c5ee8d821e Mon Sep 17 00:00:00 2001 From: WorldObservationLog Date: Sun, 19 May 2024 03:38:28 +0800 Subject: [PATCH] fix: missing tmp_dir.cleanup --- src/mp4.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mp4.py b/src/mp4.py index 8c4ee82..e95f344 100644 --- a/src/mp4.py +++ b/src/mp4.py @@ -209,7 +209,9 @@ def fix_encapsulate(song: bytes) -> bytes: subprocess.run(["ffmpeg", "-y", "-i", song_name.absolute(), "-fflags", "+bitexact", "-c:a", "copy", "-c:v", "copy", new_song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) with open(new_song_name.absolute(), "rb") as f: - return f.read() + encapsulated_song = f.read() + tmp_dir.cleanup() + return encapsulated_song # FFMPEG will overwrite maxBitrate in DecoderConfigDescriptor @@ -231,4 +233,6 @@ def fix_esds_box(raw_song: bytes, song: bytes) -> bytes: subprocess.run(f"mp4edit --replace moov/trak/mdia/minf/stbl/stsd/mp4a/esds:{esds_name.absolute()} {song_name.absolute()} {final_song_name.absolute()}", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) with open(final_song_name.absolute(), "rb") as f: - return f.read() \ No newline at end of file + final_song = f.read() + tmp_dir.cleanup() + return final_song