Skip to content

Instantly share code, notes, and snippets.

@itzexor
Last active October 4, 2022 02:43
Show Gist options
  • Save itzexor/2a5fa108d287f53abb13de8d18885746 to your computer and use it in GitHub Desktop.
Save itzexor/2a5fa108d287f53abb13de8d18885746 to your computer and use it in GitHub Desktop.
Audible stuff
prereq:
audible-cli
aax2mp3
parallel
bento4 mp4 tools (not libmp4v2)
these are the commands i use to download and convert audible audiobooks into un-drm'd m4b files.
i store these scripts and the unprocessed raw aaxc files on a hdd and have the converted books written
on to my ssd just to make it faster, but it can all be in one place
--------------------------------------------------------------------------------------------------------
for pip local-installed audible-cli. this just lets you download a book by name into the
folder within PWD called pending_raws
audible_download.sh:
#!/bin/sh
export PATH=$PATH:~/.local/bin/
audible download --chapter --cover --pdf --aaxc -o pending_raws -t "$@"
--------------------------------------------------------------------------------------------------------
this one converts them to decrypted direct-copy aac in a m4b container, using aax2mp3 in PWD,
and puts them in ~/Audiobook/
convert_pending.sh:
#!/bin/sh
parallel -j 3 ./AAXtoMP3 --single --use-audible-cli-data --target_dir ~ -e:m4b {} ::: $(find pending_raws/ -type f -name "*.aaxc")
mv pending_raws/* converted_raws/
--------------------------------------------------------------------------------------------------------
this removes colons from the name since that breaks on windows and android,
and possibly ios if you could actually put a file on it. it then fixes a somewhat
frequent error in the aac from audible that breaks when used with some stuff [ffmpeg?, etc]
more info and the script "fix.sh" is contained at https://rentry.co/n4ost [https://archive.ph/IUVJu]
post_process.sh:
#!/bin/sh
find ~/Audiobook/ -execdir rename ':' ' -' {} \+
find ~/Audiobook/ -type f -name "*.m4b" -exec ./fix.sh {} \;
find ~/Audiobook/ -type f -name "*.pre-fix" -exec rm {} \;
after this the audiobooks can be moved wherever from ~/Audiobook/ in my case i would then upload
it to my audiobookshelf instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment