1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
Tyrel Souza 4c95362855
readme 2023-10-08 19:46:25 -04:00
Tyrel Souza f2f550bfa1
finish rip 2023-10-08 19:44:14 -04:00
Tyrel Souza 3b4d72de8e
fix quoting 2023-10-08 14:48:58 -04:00
3 changed files with 30 additions and 3 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
requires ffmpeg compiled with aac support
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

View File

@ -46,7 +46,7 @@ title={title}
'-map_metadata', '1',
'-c:a', 'libfdk_aac',
'-b:a', '128k',
'-f', 'mp4', f'"{self.title}.m4b"',
'-f', 'mp4', f'{self.title}.m4b',
]
if subprocess.run(commands).returncode == 0:
print("FFmpeg Script Ran Successfully")

28
rip.py
View File

@ -1,6 +1,30 @@
# name=$(basename "$1" .aax)
import os
import subprocess
import sys
# ffmpeg -y -activation_bytes $KEY -i "$name.aax" -map_metadata 0 -id3v2_version 3 -codec:a copy -vn "output/$name.m4b"
# mv "$name.aax" "converted/$name.aax"
def rip(filename):
key = os.environ.get("AUDIBLE_KEY")
if not key:
raise Exception("set envvar AUDIBLE_KEY")
name = filename[:-4]
commands = [
"ffmpeg",
"-y",
"-activation_bytes", key,
"-i", f"{name}.aax",
"-map_metadata", "0",
"-id3v2_version", "3",
"-codec:a", "copy",
"-vn", f"output/{name}.m4b"
]
if subprocess.run(commands).returncode == 0:
print("FFmpeg Script Ran Successfully")
subprocess.run(["mv", f"{name}.aax", f"converted/{name}.aax"])
else:
print("There was an error ripping")
if __name__ == "__main__":
main()
rip(sys.argv[-1])