AAXtoMP3[1] fails to split up AAXC files to chapters. The reason for this is due to an error in the RegEx Find command to pick up the extra cover image in better quality. Audible-cli dumped two jpg files for the cover: One 500×500 pixels ($bookname_(500).jpg) and the other 1215×1215 pixels ($bookname_(1215).jpg). The find command picks up _both_, which introduces a linebreak resulting in a stat error breaking the script. Creating the chapters comes after this step and while the resulting MP3 is fine in itself I really do prefer chapter files over one huge blob.

Since the AAXtoMP3 project is archived I can’t report any bugs to it but this is my dirty fix adding tail to the mix to only get the last result:


diff --git AAXtoMP3 AAXtoMP3
index 0a6c2e0..98a30ce 100755
--- AAXtoMP3
+++ AAXtoMP3
@@ -467,7 +467,8 @@ validate_extra_files() {

# Cover
extra_dirname="$(dirname "${extra_media_file}")"
- extra_find_command='$FIND "${extra_dirname}" -maxdepth 1 -regex ".*/${extra_title##*/}_([0-9]+)\.jpg"'
+ extra_find_command='$FIND "${extra_dirname}" -maxdepth 1 -regex ".*/${extra_title##*/}_([0-9]+)\.jpg" | tail -n1'
+
# We want the output of the find command, we will turn errexit on later
set +e errexit
extra_cover_file="$(eval ${extra_find_command})"

Happy backing up your audio books 👏

[1] The purpose of this software is to create a method for you to download and store your books just in case Audible fails for some reason.

Leave a Reply