Merge branch 'master' of github.com:KrumpetPirate/AAXtoMP3 into custom-output-folder

This commit is contained in:
fabh2o 2021-02-09 20:47:34 +01:00
commit 93478c797d
2 changed files with 33 additions and 10 deletions

View File

@ -579,16 +579,20 @@ do
fi fi
chapter_file="${output_directory}/${chapter_title}.${extension}" chapter_file="${output_directory}/${chapter_title}.${extension}"
# the ID3 tags must only be specified for *.mp3 files, # Since the .aax file allready got converted we can use
# the other container formats come with their own # -acodec copy, which is much faster than a reencodation.
# tagging mechanisms. # Since there is an issue when using copy on flac, where
id3_version_param="" # the duration of the chapters gets shown as if they where
if test "${extension}" = "mp3"; then # as long as the whole audiobook.
id3_version_param="-id3v2_version 3" chapter_codec=""
if test "${extension}" = "flac"; then
chapter_codec="flac "${compression_level_param}""
else
chapter_codec="copy"
fi fi
# Big Long chapter debug # Big Long chapter debug
debug_vars "Chapter Variables:" cover_file chapter_start chapter_end id3_version_param chapternum chapterNameScheme chapter_title chapter_file debug_vars "Chapter Variables:" cover_file chapter_start chapter_end chapternum chapterNameScheme chapter_title chapter_file
if [ "$((${continueAt} > ${chapternum}))" = "0" ]; then if [ "$((${continueAt} > ${chapternum}))" = "0" ]; then
# Extract chapter by time stamps start and finish of chapter. # Extract chapter by time stamps start and finish of chapter.
# This extracts based on time stamps start and end. # This extracts based on time stamps start and end.
@ -601,8 +605,7 @@ do
-i "${cover_file}" \ -i "${cover_file}" \
-map 0:0 \ -map 0:0 \
-map 1:0 \ -map 1:0 \
-acodec "${codec}" ${id3_version_param} \ -acodec ${chapter_codec} \
${compression_level_param} \
-metadata:s:v title="Album cover" \ -metadata:s:v title="Album cover" \
-metadata:s:v comment="Cover (Front)" \ -metadata:s:v comment="Cover (Front)" \
-metadata track="${chapternum}" \ -metadata track="${chapternum}" \

View File

@ -51,7 +51,9 @@ bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [--level <COMPRESS
* **-c** or **--chaptered** Output a single file per chapter. The `--chaptered` will only work if it follows the `--aac -e:m4a -e:m4b --flac` options. * **-c** or **--chaptered** Output a single file per chapter. The `--chaptered` will only work if it follows the `--aac -e:m4a -e:m4b --flac` options.
* **--continue &lt;CHAPTERNUMBER&gt;** If the splitting into chapters gets interrupted (e.g. by a weak battery on your laptop) you can go on where the process got interrupted. Just delete the last chapter (which was incompletely generated) and redo the task with "--continue &lt;CHAPTERNUMBER&gt;" where CHAPTERNUMBER is the chapter that got interrupted. * **--continue &lt;CHAPTERNUMBER&gt;** If the splitting into chapters gets interrupted (e.g. by a weak battery on your laptop) you can go on where the process got interrupted. Just delete the last chapter (which was incompletely generated) and redo the task with "--continue &lt;CHAPTERNUMBER&gt;" where CHAPTERNUMBER is the chapter that got interrupted.
* **--level &lt;COMPRESSIONLEVEL&gt;** Set compression level. May be given for mp3, flac and opus. * **--level &lt;COMPRESSIONLEVEL&gt;** Set compression level. May be given for mp3, flac and opus.
* **--dir-naming-scheme &lt;STRING&gt;** Use a custom directory naming scheme, with variables. See [below](#custom-naming-scheme) for more info.
* **--file-naming-scheme &lt;STRING&gt;** Use a custom file naming scheme, with variables. See [below](#custom-naming-scheme) for more info.
* **--chapter-naming-scheme &lt;STRING&gt;** Use a custom chapter naming scheme, with variables. See [below](#custom-naming-scheme) for more info.
### [AUTHCODE] ### [AUTHCODE]
**Your** Audible auth code (it won't correctly decode otherwise) (required). **Your** Audible auth code (it won't correctly decode otherwise) (required).
@ -119,6 +121,24 @@ __Note:__ At least one of the above must be exist. The code must also match the
* The default codec is mp3 * The default codec is mp3
* The default output is by chapter. * The default output is by chapter.
### Custom naming scheme
The following flags can modify the default naming scheme:
* **--dir-naming-scheme**
* **--file-naming-scheme**
* **--chapter-naming-scheme**
Each flag takes a string as argument. If the string contains a variable defined in the script (eg. artist, title, chapter, narrator...), the corresponding value is used.
The default options correspond to the following flags:
* `--dir-naming-scheme '$genre/$artist/$title'`
* `--file-naming-scheme '$title'`
* `--chapter-naming-scheme '$title-$(printf %0${#chaptercount}d $chapternum) $chapter'`
* If a command substitution is present in the passed string, (for example `$(printf %0${#chaptercount}d $chapternum)`, used to pad with zeros the chapter number), the commands are executed.
So you can use `--dir-naming-scheme '$(date +%Y)/$artist'`, but using `--file-naming-scheme '$(rm -rf /)'` is a really bad idea. Be careful.
* You can use basic text, like `--dir-naming-scheme 'Converted/$title'`
* You can also use shell variables as long as you escape them properly: `CustomGenre=Horror ./AAXtoMP3 --dir-naming-scheme "$CustomGenre/\$artist/\$title" *.aax`
* If you want shorter chapter names, use `--chapter-naming-scheme '$(printf %0${#chaptercount}d $chapternum) $chapter'`: only chapter number and chapter name
* If you want to append the narrator name to the title, use `--dir-naming-scheme '$genre/$artist/$title-$narrator' --file-naming-scheme '$title-$narrator'`
* If you don't want to have the books separated by author, use `--dir-naming-scheme '$genre/$title'`
### Installing Dependencies. ### Installing Dependencies.
#### FFMPEG,FFPROBE #### FFMPEG,FFPROBE
__Ubuntu, Linux Mint, Debian__ __Ubuntu, Linux Mint, Debian__