mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
Added .authcode support and fixed README
This commit is contained in:
parent
aa93813892
commit
a8bddf3df1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
ACTIVATION
|
||||
.authcode
|
||||
|
47
AAXtoMP3.sh
47
AAXtoMP3.sh
@ -4,6 +4,12 @@ set -o errexit -o noclobber -o nounset -o pipefail
|
||||
|
||||
codec=libmp3lame
|
||||
extension=mp3
|
||||
mode=chaptered
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: bash AAXtoMP3.sh [--flac] [--single] AUTHCODE {FILES}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" = '--flac' ]]
|
||||
then
|
||||
@ -12,8 +18,18 @@ then
|
||||
shift
|
||||
fi
|
||||
|
||||
auth_code=$1
|
||||
shift
|
||||
if [[ "$1" == '--single' ]]
|
||||
then
|
||||
mode=single
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ ! -f .authcode ]; then
|
||||
auth_code=$1
|
||||
shift
|
||||
else
|
||||
auth_code=`head -1 .authcode`
|
||||
fi
|
||||
|
||||
debug() {
|
||||
echo "$(date "+%F %T%z") ${1}"
|
||||
@ -56,19 +72,22 @@ do
|
||||
|
||||
debug "Created ${full_file_path}."
|
||||
|
||||
debug "Extracting chapter files from ${full_file_path}..."
|
||||
if [ "${mode}" == "chaptered" ]; then
|
||||
debug "Extracting chapter files from ${full_file_path}..."
|
||||
|
||||
while read -r -u9 first _ _ start _ end
|
||||
do
|
||||
if [[ "${first}" = "Chapter" ]]
|
||||
then
|
||||
read -r -u9 _
|
||||
read -r -u9 _ _ chapter
|
||||
chapter_file="${output_directory}/${title} - ${chapter}.${extension}"
|
||||
ffmpeg -loglevel error -stats -i "${full_file_path}" -ss "${start%?}" -to "${end}" -codec:a copy "${chapter_file}"
|
||||
fi
|
||||
done 9< "$metadata_file"
|
||||
debug "Done creating chapters. Single file and chaptered files contained in ${output_directory}."
|
||||
while read -r -u9 first _ _ start _ end
|
||||
do
|
||||
if [[ "${first}" = "Chapter" ]]
|
||||
then
|
||||
read -r -u9 _
|
||||
read -r -u9 _ _ chapter
|
||||
chapter_file="${output_directory}/${title} - ${chapter}.${extension}"
|
||||
ffmpeg -loglevel error -stats -i "${full_file_path}" -ss "${start%?}" -to "${end}" -codec:a copy "${chapter_file}"
|
||||
fi
|
||||
done 9< "$metadata_file"
|
||||
rm ${full_file_path}
|
||||
debug "Done creating chapters. Chaptered files contained in ${output_directory}."
|
||||
fi
|
||||
|
||||
cover_path="${output_directory}/cover.jpg"
|
||||
debug "Extracting cover into ${cover_path}..."
|
||||
|
22
README.md
22
README.md
@ -1,6 +1,6 @@
|
||||
# AAXtoMP3
|
||||
The purpose of this software is to convert AAX files to a more common MP3 format
|
||||
through a basic perl script frontend to FFMPEG.
|
||||
through a basic bash script frontend to FFMPEG.
|
||||
|
||||
Audible uses this file format to maintain DRM restrictions on their audio
|
||||
books and if you download your book through your library it will be
|
||||
@ -12,10 +12,6 @@ your **personal** Audible account. 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.
|
||||
|
||||
I recently converted this script to bash instead of perl. Something about more people knowing bash or something rather.
|
||||
Additionally I put some work into creating chaptered files as well as the mp3 version. A directory of structure GENRE/WRITER/TITLE
|
||||
will contain the large mp3 as well as chaptered mp3s extracted from the AAX file metadata.
|
||||
|
||||
TODO: Automatically fix the MP3 tags on the generated audio files. For now I use easytag which seems to work okay.
|
||||
|
||||
## Setup
|
||||
@ -25,7 +21,6 @@ can obtain this string from a tool like [audible-activator](https://github.com/i
|
||||
|
||||
## Requirements
|
||||
* bash 4.3.42 or later tested
|
||||
* ~~perl version 5.22.0 or later~~ (Converted the script to bash for greater readability!)
|
||||
* ffmpeg version 2.8.3 or later
|
||||
* libmp3lame (came from lame package on Arch, not sure where else this is stored)
|
||||
|
||||
@ -36,12 +31,19 @@ bash AAXtoMP3.sh <AUTHCODE> {INPUT_FILES}
|
||||
* AUTHCODE: **your** Audible auth code (it won't correctly decode otherwise) (required)
|
||||
* Everything else is considered an input file, useful for batching!
|
||||
|
||||
Tested on Linux with the above requirements. No effort will be made to
|
||||
port this work to any other operating system, though it may work fine. Want a Windows/
|
||||
OSX port? You'll have to fork the work.
|
||||
You can also convert the output to FLAC encoding instead of MP3 by doing the following *in order*
|
||||
```
|
||||
bash AAXtoMP3.sh --flac <AUTHCODE> {INPUT_FILES}
|
||||
```
|
||||
Additionally, if you have a .authcode file available in the current working directory, it will read the first line of
|
||||
that line and treat it like your auth_code. For example here is the full usage with a
|
||||
.authcode file available:
|
||||
```
|
||||
bash AAXtoMP3.sh [--flac] [--single] {FILES}
|
||||
```
|
||||
|
||||
## Anti-Piracy Notice
|
||||
Note that this project does NOT ‘crack’ the DRM. It simplys allows the user to
|
||||
Note that this project does NOT ‘crack’ the DRM. It simply allows the user to
|
||||
use their own encryption key (fetched from Audible servers) to decrypt the
|
||||
audiobook in the same manner that the official audiobook playing software does.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user