From 1132602f657a46f684046e73e8aff369a8b6f651 Mon Sep 17 00:00:00 2001 From: Adam Baxter Date: Thu, 16 Nov 2017 00:16:24 +1100 Subject: [PATCH 01/15] Add support for copying to m4b (no reencode) --- AAXtoMP3 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index b53bec6..e8b0ba0 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -15,7 +15,7 @@ if ! [[ $(type -P "$GREP") ]]; then fi if [ "$#" -eq 0 ]; then - echo "Usage: bash AAXtoMP3.sh [--flac] [--single] AUTHCODE {FILES}" + echo "Usage: bash AAXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES}" exit 1 fi @@ -26,6 +26,13 @@ then shift fi +if [[ "$1" == '--aac' ]] +then + codec=copy + extension=m4b + shift +fi + if [[ "$1" == '--single' ]] then mode=single From a09e50257468f9daf01032848be9b2041054abc4 Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Sun, 18 Feb 2018 00:27:31 -0600 Subject: [PATCH 02/15] Fixed ':' in input file name protocol error --- AAXtoMP3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index b53bec6..6a7c82a 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -74,7 +74,7 @@ do save_metadata "${path}" genre=$(get_metadata_value genre) artist=$(get_metadata_value artist) - title=$(get_metadata_value title) + title=$(get_metadata_value title) | sed -e 's/\:/-/g' | xargs -0 output_directory="$(dirname "${path}")/${genre}/${artist}/${title}" mkdir -p "${output_directory}" full_file_path="${output_directory}/${title}.${extension}" From ed084692a272f3f875991903433fd7856390785c Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Sun, 18 Feb 2018 00:34:33 -0600 Subject: [PATCH 03/15] Updated README --- README.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index dd07450..3593cf3 100644 --- a/README.md +++ b/README.md @@ -31,27 +31,16 @@ Thanks to kbabioch, this script has also been packaged in the [AUR](https://aur. ## Usage ``` -bash AAXtoMP3 {INPUT_FILES} +bash AAXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES} ``` * AUTHCODE: **your** Audible auth code (it won't correctly decode otherwise) (required) * Everything else is considered an input file, useful for batching! -You can also convert the output to FLAC encoding instead of MP3 by doing the following *in order*: -``` -bash AAXtoMP3 --flac {INPUT_FILES} -``` -Note that FLAC encoding is typically a little faster, at the cost of compatibility with some players. - -If you wish to convert to a single file you can add --single to the input. This will prevent chaptered content from being extracted. +Note that any optional flags have to be inputed *in order* to function correctly. 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. When you do this you do not need to specify an AUTHCODE input. -Here is the full usage (NOTE: Order matters!) -``` -bash AAXtoMP3 [--flac] [--single] AUTHCODE {FILES} -``` - ## Anti-Piracy Notice 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 From 0c2c439d55d301de9cce5b01b09c9ea165cef255 Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Sun, 18 Feb 2018 01:13:00 -0600 Subject: [PATCH 04/15] Removed AAX, causes issues with some audiobooks --- AAXtoMP3 | 17 +++++++++-------- README.md | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index 6475fc5..c520b33 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -15,7 +15,8 @@ if ! [[ $(type -P "$GREP") ]]; then fi if [ "$#" -eq 0 ]; then - echo "Usage: bash AAXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES}" + #echo "Usage: bash AXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES}" + echo "Usage: bash AXtoMP3.sh [--flac] [--single] AUTHCODE {FILES}" exit 1 fi @@ -26,12 +27,12 @@ then shift fi -if [[ "$1" == '--aac' ]] -then - codec=copy - extension=m4b - shift -fi +#if [[ "$1" == '--aac' ]] +#then +# codec=copy +# extension=m4b +# shift +#fi if [[ "$1" == '--single' ]] then @@ -81,7 +82,7 @@ do save_metadata "${path}" genre=$(get_metadata_value genre) artist=$(get_metadata_value artist) - title=$(get_metadata_value title) | sed -e 's/\:/-/g' | xargs -0 + title=$(get_metadata_value title | sed 's/'\:'/'-\ '/g' | xargs -0) output_directory="$(dirname "${path}")/${genre}/${artist}/${title}" mkdir -p "${output_directory}" full_file_path="${output_directory}/${title}.${extension}" diff --git a/README.md b/README.md index 3593cf3..fc665b4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Thanks to kbabioch, this script has also been packaged in the [AUR](https://aur. ## Usage ``` -bash AAXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES} +bash AAXtoMP3.sh [--flac] [--single] AUTHCODE {FILES} ``` * AUTHCODE: **your** Audible auth code (it won't correctly decode otherwise) (required) * Everything else is considered an input file, useful for batching! From d7752b4779ea7dc880483020b15c17035b751261 Mon Sep 17 00:00:00 2001 From: Blade Gunner Date: Sat, 3 Mar 2018 17:57:25 +0100 Subject: [PATCH 05/15] add support for the opus codec it seems like ffmpeg still has some issues with the native opus container format (*.opus), so let's use the OGG container format for now. --- AAXtoMP3 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index c520b33..df3fb02 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -34,6 +34,13 @@ fi # shift #fi +if [[ "$1" = '--opus' ]] +then + codec=libopus + extension=ogg + shift +fi + if [[ "$1" == '--single' ]] then mode=single @@ -108,7 +115,16 @@ do read -r -u9 _ _ chapter chapter_title="${title} - $(printf %0${#chaptercount}d $chapternum) ${chapter}" chapter_file="${output_directory}/${chapter_title}.${extension}" - Date: Tue, 13 Mar 2018 19:39:02 -0500 Subject: [PATCH 06/15] Updated readme for OPUS convertion, gitignore to ignore aax files in directory and output dir --- .gitignore | 2 ++ AAXtoMP3 | 4 ++-- README.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 71a9d6a..bc3dd24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ ACTIVATION .authcode +*aax +Audiobook/* diff --git a/AAXtoMP3 b/AAXtoMP3 index df3fb02..c743d07 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -15,8 +15,8 @@ if ! [[ $(type -P "$GREP") ]]; then fi if [ "$#" -eq 0 ]; then - #echo "Usage: bash AXtoMP3.sh [--flac] [--aac] [--single] AUTHCODE {FILES}" - echo "Usage: bash AXtoMP3.sh [--flac] [--single] AUTHCODE {FILES}" + echo "Usage: bash AXtoMP3.sh [--flac] [--opus ] [--single] AUTHCODE {FILES}" + echo " Note that order does matter!" exit 1 fi diff --git a/README.md b/README.md index fc665b4..dd2cdfd 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Thanks to kbabioch, this script has also been packaged in the [AUR](https://aur. ## Usage ``` -bash AAXtoMP3.sh [--flac] [--single] AUTHCODE {FILES} +bash AAXtoMP3 [--flac] [--opus] [--single] AUTHCODE {FILES} ``` * AUTHCODE: **your** Audible auth code (it won't correctly decode otherwise) (required) * Everything else is considered an input file, useful for batching! From 1031e3ae1d284a05f00cadaeeb801fe5cb0365ff Mon Sep 17 00:00:00 2001 From: Me Date: Wed, 14 Mar 2018 16:46:45 +0100 Subject: [PATCH 07/15] chg: use authcode file located in HOME dir. Signed-off-by: Me --- AAXtoMP3 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index c743d07..6dcb82b 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -5,6 +5,7 @@ set -o errexit -o noclobber -o nounset -o pipefail codec=libmp3lame extension=mp3 mode=chaptered +authcodeFile="${HOME}/.authcode"; GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep") if ! [[ $(type -P "$GREP") ]]; then @@ -47,11 +48,11 @@ then shift fi -if [ ! -f .authcode ]; then +if [ ! -f "$authcodeFile" ]; then auth_code=$1 shift else - auth_code=`head -1 .authcode` + auth_code=`head -1 "$authcodeFile"` fi debug() { From 15945b18b1e0c4aa6e033ea98fa90122d01aab23 Mon Sep 17 00:00:00 2001 From: Me Date: Thu, 15 Mar 2018 00:35:57 +0100 Subject: [PATCH 08/15] chg: search HOME and local dir for authcode file in this order, first occurence accepted. Signed-off-by: Me --- AAXtoMP3 | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index 6dcb82b..d1bb0a3 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -5,7 +5,8 @@ set -o errexit -o noclobber -o nounset -o pipefail codec=libmp3lame extension=mp3 mode=chaptered -authcodeFile="${HOME}/.authcode"; +authcode=".authcode"; +authcodeDirs="${HOME}/ ./"; GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep") if ! [[ $(type -P "$GREP") ]]; then @@ -48,12 +49,26 @@ then shift fi -if [ ! -f "$authcodeFile" ]; then - auth_code=$1 - shift -else - auth_code=`head -1 "$authcodeFile"` -fi +auth_code=""; +for dir in $authcodeDirs; do + codeFile="${dir}$authcode"; + + if [ ! -f "$codeFile" ]; then + auth_code=$1 + shift + break; + elif [ -s "$codeFile" ]; then + auth_code=`head -1 "$codeFile"` + break; + else + echo "INFO: Sorry, empty \"$codeFile\" found, skipping."; + fi; +done; + +if [ -z "$auth_code" ]; then + echo "INFO: Sorry, no authcode provided."; + exit 1; +fi; debug() { echo "$(date "+%F %T%z") ${1}" From 2ae7e326bbaa5e4e037e9c4019fdd04f0ea0556c Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Thu, 22 Mar 2018 14:06:19 -0500 Subject: [PATCH 09/15] Renabled AAC for copy with no re-encode step --- AAXtoMP3 | 14 +++++++------- README.md | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index d1bb0a3..e53b8de 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -17,7 +17,7 @@ if ! [[ $(type -P "$GREP") ]]; then fi if [ "$#" -eq 0 ]; then - echo "Usage: bash AXtoMP3.sh [--flac] [--opus ] [--single] AUTHCODE {FILES}" + echo "Usage: bash AXtoMP3 [--flac] [--aac] [--opus ] [--single] AUTHCODE {FILES}" echo " Note that order does matter!" exit 1 fi @@ -29,12 +29,12 @@ then shift fi -#if [[ "$1" == '--aac' ]] -#then -# codec=copy -# extension=m4b -# shift -#fi +if [[ "$1" == '--aac' ]] +then + codec=copy + extension=m4a + shift +fi if [[ "$1" = '--opus' ]] then diff --git a/README.md b/README.md index dd2cdfd..3ce72dc 100644 --- a/README.md +++ b/README.md @@ -30,16 +30,15 @@ conversions in OSX. It is recommended that you install GNU grep using 'brew inst Thanks to kbabioch, this script has also been packaged in the [AUR](https://aur.archlinux.org/packages/aaxtomp3-git/). Note that you will still need to extract your activation bytes before use. ## Usage -``` -bash AAXtoMP3 [--flac] [--opus] [--single] AUTHCODE {FILES} +```bash +bash AAXtoMP3 [--flac] [--aac] [--opus] [--single] AUTHCODE {FILES} ``` * AUTHCODE: **your** Audible auth code (it won't correctly decode otherwise) (required) * Everything else is considered an input file, useful for batching! Note that any optional flags have to be inputed *in order* to function correctly. -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. When you do this you do not need to specify an AUTHCODE input. +Additionally, if you have a .authcode file available in either your home directory or the current working directory, it will read the first line of that line and treat it like your auth_code. When you do this you do not need to specify an AUTHCODE input. ## Anti-Piracy Notice Note that this project does NOT ‘crack’ the DRM. It simply allows the user to From 120f02fe0772a8df332d559ffa3d0fb30ff9b564 Mon Sep 17 00:00:00 2001 From: SendSpams <36188980+SendSpams@users.noreply.github.com> Date: Fri, 6 Apr 2018 07:02:00 +0100 Subject: [PATCH 10/15] Modified to work with missing HOME environment variable under Windows The HOME environment variable is not set on Windows by default. Instead Windows uses USERPROFILE. It is possible for HOME to be set on Windows but for users who have not done this they will get: `HOME: unbound variable`. I have added a line that sets HOME to USERPROFILE if HOME is missing and USERPROFILE is found. This solves the unbound variable error. --- AAXtoMP3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index e53b8de..6c9778b 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -6,7 +6,7 @@ codec=libmp3lame extension=mp3 mode=chaptered authcode=".authcode"; -authcodeDirs="${HOME}/ ./"; +if [ -z ${HOME+x} ] && ! [ -z ${USERPROFILE+x} ]; then HOME="$USERPROFILE"; fi GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep") if ! [[ $(type -P "$GREP") ]]; then From 1d1f738713fa3a9835bb77e9024b931c9d58eb39 Mon Sep 17 00:00:00 2001 From: SendSpams <36188980+SendSpams@users.noreply.github.com> Date: Fri, 6 Apr 2018 07:03:25 +0100 Subject: [PATCH 11/15] Update AAXtoMP3 --- AAXtoMP3 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AAXtoMP3 b/AAXtoMP3 index 6c9778b..e0e6f1f 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -7,6 +7,8 @@ extension=mp3 mode=chaptered authcode=".authcode"; if [ -z ${HOME+x} ] && ! [ -z ${USERPROFILE+x} ]; then HOME="$USERPROFILE"; fi +authcodeDirs="${HOME}/ ./" + GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep") if ! [[ $(type -P "$GREP") ]]; then From db014f8f51395f629d25f5ada89da95c19cdc459 Mon Sep 17 00:00:00 2001 From: SendSpams <36188980+SendSpams@users.noreply.github.com> Date: Fri, 6 Apr 2018 07:04:19 +0100 Subject: [PATCH 12/15] Update AAXtoMP3 --- AAXtoMP3 | 1 - 1 file changed, 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index e0e6f1f..8bf5418 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -8,7 +8,6 @@ mode=chaptered authcode=".authcode"; if [ -z ${HOME+x} ] && ! [ -z ${USERPROFILE+x} ]; then HOME="$USERPROFILE"; fi authcodeDirs="${HOME}/ ./" - GREP=$(grep --version | grep -q GNU && echo "grep" || echo "ggrep") if ! [[ $(type -P "$GREP") ]]; then From ee0c9715449321f61294e243532bb54defccc5d1 Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Fri, 6 Apr 2018 11:03:33 -0500 Subject: [PATCH 13/15] Set theme jekyll-theme-slate --- _config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 _config.yml diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c741881 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file From 219255826bd272dc72a14945085fea7402851494 Mon Sep 17 00:00:00 2001 From: KrumpetPirate Date: Fri, 6 Apr 2018 11:12:47 -0500 Subject: [PATCH 14/15] Removed chaptered support from AAC encoding, doesn't seem to function --- AAXtoMP3 | 1 + 1 file changed, 1 insertion(+) diff --git a/AAXtoMP3 b/AAXtoMP3 index 8bf5418..7e52bb3 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -34,6 +34,7 @@ if [[ "$1" == '--aac' ]] then codec=copy extension=m4a + mode=single shift fi From 6ed19fcde2fb9f63d38d0587e8177833f805b002 Mon Sep 17 00:00:00 2001 From: thunder-hammer Date: Mon, 16 Apr 2018 16:09:47 -0600 Subject: [PATCH 15/15] Update AAXtoMP3 Corrected spelling in usage prompt --- AAXtoMP3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AAXtoMP3 b/AAXtoMP3 index 7e52bb3..3fa4de7 100755 --- a/AAXtoMP3 +++ b/AAXtoMP3 @@ -18,7 +18,7 @@ if ! [[ $(type -P "$GREP") ]]; then fi if [ "$#" -eq 0 ]; then - echo "Usage: bash AXtoMP3 [--flac] [--aac] [--opus ] [--single] AUTHCODE {FILES}" + echo "Usage: bash AAXtoMP3 [--flac] [--aac] [--opus ] [--single] AUTHCODE {FILES}" echo " Note that order does matter!" exit 1 fi