2020-05-15 19:33:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
2020-02-03 08:00:41 +00:00
|
|
|
|
2021-08-22 18:04:33 +00:00
|
|
|
# If you don't have AUDIBLE_ACTIVATION_BYTES, run
|
|
|
|
# podman run -v $(pwd):/data ryanfb/inaudible@sha256:b66738d235be1007797e3a0a0ead115fa227e81e2ab5b7befb97d43f7712fac5
|
|
|
|
# Or if that isn't possible, see this project: https://github.com/inAudible-NG/tables
|
|
|
|
# Getting AUDIBLE_ACTIVATION_BYTES for your account is a one-time thing, it remains same forever.
|
|
|
|
# So once you have it, you can save it and then re-use it for instant future decryption using ffmpeg.
|
|
|
|
|
|
|
|
# This gets it from my password manager
|
2021-09-29 08:01:20 +00:00
|
|
|
export AUDIBLE_ACTIVATION_BYTES=$(pass show Keys/AUDIBLE_ACTIVATION_BYTES)
|
|
|
|
|
2021-08-22 18:04:33 +00:00
|
|
|
for i in *.aax; do
|
|
|
|
m4a_file="${i%%.*}.m4a"
|
|
|
|
if [ ! -e "$m4a_file" ]; then
|
2021-09-29 08:01:20 +00:00
|
|
|
ffmpeg -loglevel panic -y -activation_bytes ${AUDIBLE_ACTIVATION_BYTES} -i "$i" -c:a copy -movflags +faststart -vn "$m4a_file"
|
|
|
|
# See https://github.com/captn3m0/Scripts/blob/master/fix-audible-m4a for this script
|
|
|
|
# Dependencies are: bento4 (https://aur.archlinux.org/packages/bento4/)
|
|
|
|
# bash, and sed
|
2021-08-22 18:04:33 +00:00
|
|
|
fix-audible-m4a "$m4a_file"
|
|
|
|
fi
|
|
|
|
done
|