fix: missing tmp_dir.cleanup

with_status
WorldObservationLog 4 months ago
parent afd1213e5f
commit b38949d0da
  1. 8
      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", 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) new_song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
with open(new_song_name.absolute(), "rb") as f: 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 # 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()}", 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) stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
with open(final_song_name.absolute(), "rb") as f: with open(final_song_name.absolute(), "rb") as f:
return f.read() final_song = f.read()
tmp_dir.cleanup()
return final_song

Loading…
Cancel
Save