Skip to content

Instantly share code, notes, and snippets.

@Kagee
Created August 24, 2016 16:59
Show Gist options
  • Save Kagee/464ce7632d7fb710355f312db532c3da to your computer and use it in GitHub Desktop.
Save Kagee/464ce7632d7fb710355f312db532c3da to your computer and use it in GitHub Desktop.
#! /bin/bash
ACTIVATION_BYTES="<https://github.com/inAudible-NG/audible-activator>"
FROM="./From"
TO="./To"
FFMPEG="ffmpeg/ffmpeg"
COUNT_FROM="$(ls "$FROM" | wc -l)"
# only aax, something fails with .aa, and i'm not up to debugging
for FROMPATH in $FROM/*.aax; do
#echo "$FROMPATH";
TOPATH="$TO/$(basename "$FROMPATH" | cut -d'_' -f 1).mp4"
if [ ! -e "$TOPATH" ]; then
echo "$FROMPATH => $TOPATH"
$FFMPEG -loglevel error -activation_bytes "$ACTIVATION_BYTES" -i "$FROMPATH" -vn -c:a copy "$TOPATH"
else
echo "$TOPATH found, skipping"
fi
done
COUNT_TO="$(ls "$TO" | wc -l)"
if [ "$COUNT_FROM" -gt "$COUNT_TO" ]; then
echo "$COUNT_FROM sourcefiles, $COUNT_TO destination files, possible error in conversion or duplicate title";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment