mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
Adding --complete_dir option and documentation
This commit is contained in:
parent
1727d10be3
commit
8327f15ac2
28
AAXtoMP3
28
AAXtoMP3
@ -5,14 +5,15 @@
|
|||||||
# Command Line Options
|
# Command Line Options
|
||||||
|
|
||||||
# Usage Synopsis.
|
# Usage Synopsis.
|
||||||
usage=$'\nUsage: AAXtoMP3 [--flac] [--aac] [--opus ] [--single] [--chaptered]\n[-e:m4a] [-e:m4b] [--authcode <AUTHCODE>] [--output_dir <PATH>] {FILES}\n'
|
usage=$'\nUsage: AAXtoMP3 [--flac] [--aac] [--opus ] [--single] [--chaptered]\n[-e:m4a] [-e:m4b] [--authcode <AUTHCODE>] [--output_dir <PATH>]\n[--complete_dir <PATH>] {FILES}\n'
|
||||||
codec=libmp3lame # Default encoder.
|
codec=libmp3lame # Default encoder.
|
||||||
extension=mp3 # Default encoder extention.
|
extension=mp3 # Default encoder extention.
|
||||||
mode=chaptered # Multi file output
|
mode=chaptered # Multi file output
|
||||||
auth_code= # Required to be set via file or option.
|
auth_code= # Required to be set via file or option.
|
||||||
targetdir= # Optional output location. Note default is basedir of AAX file.
|
targetdir= # Optional output location. Note default is basedir of AAX file.
|
||||||
DEBUG=0 # Default off, If set extremely verbose output.
|
completedir= # Optional location to move aax files once the decoding is complete.
|
||||||
container=mp3 # Just in case we need to change the container. Used for M4A to M4B
|
container=mp3 # Just in case we need to change the container. Used for M4A to M4B
|
||||||
|
DEBUG=0 # Default off, If set extremely verbose output.
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Code tip Do not have any script above this point that calls a function or a binary. If you do
|
# Code tip Do not have any script above this point that calls a function or a binary. If you do
|
||||||
@ -39,6 +40,8 @@ while true; do
|
|||||||
-e:m4b ) codec=copy; extension=m4a; mode=single; container=m4b; shift ;;
|
-e:m4b ) codec=copy; extension=m4a; mode=single; container=m4b; shift ;;
|
||||||
# Change the working dir from AAX directory to what you choose.
|
# Change the working dir from AAX directory to what you choose.
|
||||||
-t | --target_dir ) targetdir="$2"; shift 2 ;;
|
-t | --target_dir ) targetdir="$2"; shift 2 ;;
|
||||||
|
# Move the AAX file to a new directory when decoding is complete.
|
||||||
|
-C | --complete_dir ) completedir="$2"; shift 2 ;;
|
||||||
# Authorization code associate with the AAX file(s)
|
# Authorization code associate with the AAX file(s)
|
||||||
-A | --authcode ) auth_code="$2"; shift 2 ;;
|
-A | --authcode ) auth_code="$2"; shift 2 ;;
|
||||||
# Extremely verbose output.
|
# Extremely verbose output.
|
||||||
@ -108,7 +111,17 @@ fi
|
|||||||
# Check the target dir for if set if it is writable
|
# Check the target dir for if set if it is writable
|
||||||
if [[ "x${targetdir}" != "x" ]]; then
|
if [[ "x${targetdir}" != "x" ]]; then
|
||||||
if [[ ! -w "${targetdir}" || ! -d "${targetdir}" ]] ; then
|
if [[ ! -w "${targetdir}" || ! -d "${targetdir}" ]] ; then
|
||||||
echo "ERROR Target Directory is not writable: \"$targetdir\""
|
echo "ERROR Target Directory does not exist or is not writable: \"$targetdir\""
|
||||||
|
echo "$usage"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -----
|
||||||
|
# Check the target dir for if set if it is writable
|
||||||
|
if [[ "x${completedir}" != "x" ]]; then
|
||||||
|
if [[ ! -w "${completedir}" || ! -d "${completedir}" ]] ; then
|
||||||
|
echo "ERROR Complete Directory does not exist or is not writable: \"$completedir\""
|
||||||
echo "$usage"
|
echo "$usage"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -257,7 +270,6 @@ do
|
|||||||
chapter_title="${title}-$(printf %0${#chaptercount}d $chapternum) ${chapter}"
|
chapter_title="${title}-$(printf %0${#chaptercount}d $chapternum) ${chapter}"
|
||||||
chapter_file="${output_directory}/${chapter_title}.${extension}"
|
chapter_file="${output_directory}/${chapter_title}.${extension}"
|
||||||
|
|
||||||
|
|
||||||
# the ID3 tags must only be specified for *.mp3 files,
|
# the ID3 tags must only be specified for *.mp3 files,
|
||||||
# the other container formats come with their own
|
# the other container formats come with their own
|
||||||
# tagging mechanisms.
|
# tagging mechanisms.
|
||||||
@ -322,4 +334,12 @@ do
|
|||||||
log "Done ${title}"
|
log "Done ${title}"
|
||||||
# Lastly get rid of any extra stuff.
|
# Lastly get rid of any extra stuff.
|
||||||
rm "${metadata_file}"
|
rm "${metadata_file}"
|
||||||
|
|
||||||
|
# Move the aax file if the decode is completed and the --complete_dir is set to a valid location.
|
||||||
|
# Check the target dir for if set if it is writable
|
||||||
|
if [[ "x${completedir}" != "x" ]]; then
|
||||||
|
log "Moving Transcoded ${path} to ${completedir}"
|
||||||
|
mv "${path}" "${completedir}"
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
@ -28,7 +28,7 @@ Thanks to kbabioch, this script has also been packaged in the [AUR](https://aur.
|
|||||||
|
|
||||||
## Usage(s)
|
## Usage(s)
|
||||||
```
|
```
|
||||||
bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [-c|--chaptered] [-e:mp3] [-e:m4a] [-e:m4b] [-A|--authcode <AUTHCODE>] [-t|--target_dir <PATH>] [-d|--debug] [-h|--help] <AAX INPUT_FILES>...
|
bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [-c|--chaptered] [-e:mp3] [-e:m4a] [-e:m4b] [-A|--authcode <AUTHCODE>] [-t|--target_dir <PATH>] [-C|--complete_dir <PATH>] [-d|--debug] [-h|--help] <AAX INPUT_FILES>...
|
||||||
```
|
```
|
||||||
|
|
||||||
* **<AAX INPUT_FILES>**... are considered input file(s), useful for batching!
|
* **<AAX INPUT_FILES>**... are considered input file(s), useful for batching!
|
||||||
@ -39,6 +39,7 @@ bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [-c|--chaptered] [
|
|||||||
* **-a** or **--aac** AAC Encoding and produce a m4a single files output.
|
* **-a** or **--aac** AAC Encoding and produce a m4a single files output.
|
||||||
* **-A** or **--authcode <AUTHCODE>** for this execution of the command use the provided <AUTHCODE> to decode the AAX file.
|
* **-A** or **--authcode <AUTHCODE>** for this execution of the command use the provided <AUTHCODE> to decode the AAX file.
|
||||||
* **-t** or **--target_dir <PATH>** change the default output location to the named <PATH>. Note the default location is ./Audiobook of the directory to which each AAX file resides.
|
* **-t** or **--target_dir <PATH>** change the default output location to the named <PATH>. Note the default location is ./Audiobook of the directory to which each AAX file resides.
|
||||||
|
* **-C** or **--complete_dir <PATH>** a directory to place aax files after they have been decoded successfully. Note make a back up of your aax files prior to using this option. Just in case something goes wrong.
|
||||||
* **-e:mp3** Identical to defaults.
|
* **-e:mp3** Identical to defaults.
|
||||||
* **-e:m4a** Create a m4a audio file. This is identical to --aac
|
* **-e:m4a** Create a m4a audio file. This is identical to --aac
|
||||||
* **-e:m4b** Create a m4b aduio file. This is the book version of the m4a format.
|
* **-e:m4b** Create a m4b aduio file. This is the book version of the m4a format.
|
||||||
|
Loading…
Reference in New Issue
Block a user