Compare commits

..

No commits in common. 'e40f8fec5ee098227df158f224ecdf7bb7cd45f6' and '35a520fcf77803faf6c9f7b2224c9a4b0260d0b2' have entirely different histories.

  1. 7
      src/mp4.py

@ -197,7 +197,7 @@ async def write_metadata(song: bytes, metadata: SongMetadata, embed_metadata: li
subprocess.run(["mp4box", "-time", time, "-mtime", time, "-name", f"1={metadata.title}", "-itags", subprocess.run(["mp4box", "-time", time, "-mtime", time, "-name", f"1={metadata.title}", "-itags",
":".join(["tool=", f"cover={absolute_cover_path}", ":".join(["tool=", f"cover={absolute_cover_path}",
metadata.to_itags_params(embed_metadata)]), metadata.to_itags_params(embed_metadata)]),
song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell())
with open(song_name.absolute(), "rb") as f: with open(song_name.absolute(), "rb") as f:
embed_song = f.read() embed_song = f.read()
tmp_dir.cleanup() tmp_dir.cleanup()
@ -214,9 +214,8 @@ async def fix_encapsulate(song: bytes) -> bytes:
new_song_name = Path(tmp_dir.name) / Path(f"{name}_fixed.m4a") new_song_name = Path(tmp_dir.name) / Path(f"{name}_fixed.m4a")
with open(song_name.absolute(), "wb") as f: with open(song_name.absolute(), "wb") as f:
f.write(song) f.write(song)
subprocess.run( subprocess.run(["ffmpeg", "-y", "-i", song_name.absolute(), "-fflags", "+bitexact", "-c:a", "copy", "-c:v", "copy",
f"ffmpeg -y -i {song_name.absolute()} -fflags +bitexact -c:a copy -c:v copy {new_song_name.absolute()}", new_song_name.absolute()], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell())
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=if_shell())
with open(new_song_name.absolute(), "rb") as f: with open(new_song_name.absolute(), "rb") as f:
encapsulated_song = f.read() encapsulated_song = f.read()
tmp_dir.cleanup() tmp_dir.cleanup()

Loading…
Cancel
Save