Free your audio books!
A well-known, big online vendor of audio books doesn't offer its titles in the well-known and widely supported form of mp3 files, but in a proprietary, DRM protected format called aax. I was not too pleases when I learned that the audio books I purchased from them were unplayable on both Linux and my good, old mp3 player running Rockbox.
Of course, I wasn't the first to struggle with this completely unnecessary bullying, and after some research I finally MacGyvered the following python script in order to facilitate both transferring audio books to a DRM-free format and splitting the recording into nice, little mp3 files.
usage: abconv.py [-h] [-x] [-c AUTHCODE] [-a AUTHOR] [-b BOOK] [-s SERIES]
[-i INSTALMENT] [-A ARTIST_TEMPLATE] [-B ALBUM_TEMPLATE]
[-T TRACK_TEMPLATE] [-p PERFORMER] [-y YEAR]
[-o OUTDIR_TEMPLATE] [-n FILENAME_TEMPLATE] [-f {mp3}]
[-t TRIM_INTRO] [-u TRIM_EXTRO] [-w PAD_WITH_SILENCE]
[-m COVER_IMAGE]
source
Convert aax audiobooks to collections of audio files.
positional arguments:
source
optional arguments:
-h, --help show this help message and exit
-x, --extract-metadata
Only extract metadata.
-c AUTHCODE, --authcode AUTHCODE
Authorization code.
-a AUTHOR, --author AUTHOR
Author name.
-b BOOK, --book BOOK Book title.
-s SERIES, --series SERIES
Series name.
-i INSTALMENT, --instalment INSTALMENT
Instalment number within series.
-A ARTIST_TEMPLATE, --artist-template ARTIST_TEMPLATE
Artist tag template. ["{author}"]
-B ALBUM_TEMPLATE, --album-template ALBUM_TEMPLATE
Album tag template. ["{series} {instalment} - {book}
for series, "{book}" else]
-T TRACK_TEMPLATE, --track-template TRACK_TEMPLATE
Track tag template. ["{album}
{chapter_number}/{chapters_count}"]
-p PERFORMER, --performer PERFORMER
Performer tag content.
-y YEAR, --year YEAR Year.
-o OUTDIR_TEMPLATE, --outdir-template OUTDIR_TEMPLATE
Output directory template.
["out/{author}/{series}/{instalment} - {book}" for
series, "out/{author}/{album}" else]
-n FILENAME_TEMPLATE, --filename-template FILENAME_TEMPLATE
Track filename template. ["{formatted_chapter_number}
- {book} {chapter_number}"]
-f {mp3}, --format {mp3}
Output format. ["mp3"]
-t TRIM_INTRO, --trim-intro TRIM_INTRO
After removing Trim start of first track by specified
number of seconds. Try 1.5 for English and 3.5 for
German audio books.
-u TRIM_EXTRO, --trim-extro TRIM_EXTRO
Trim end of last track by specified number of seconds.
Try 2.5 for both English and German audio books.
-w PAD_WITH_SILENCE, --pad-with-silence PAD_WITH_SILENCE
After trimming, pad beginning of first chapter and end
of last chapter, respectively, with the specified
number of seconds of silence. [1.0]
-m COVER_IMAGE, --cover-image COVER_IMAGE
Cover image filename. ["album.jpg"]
Requires ffmpeg to be installed and in path.