mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
force author name
This commit is contained in:
parent
ad2bbe5da4
commit
1e7802ac3f
25
AAXtoMP3
25
AAXtoMP3
@ -5,7 +5,7 @@
|
|||||||
# Command Line Options
|
# Command Line Options
|
||||||
|
|
||||||
# Usage Synopsis.
|
# Usage Synopsis.
|
||||||
usage=$'\nUsage: AAXtoMP3 [--flac] [--aac] [--opus ] [--single] [--level <COMPRESSIONLEVEL>]\n[--chaptered] [-e:mp3] [-e:m4a] [-e:m4b] [--authcode <AUTHCODE>] [--no-clobber]\n[--target_dir <PATH>] [--complete_dir <PATH>] [--validate]\n[--continue <CHAPTERNUMBER>] [--keep-artist <N>] {FILES}\n'
|
usage=$'\nUsage: AAXtoMP3 [--flac] [--aac] [--opus ] [--single] [--level <COMPRESSIONLEVEL>]\n[--chaptered] [-e:mp3] [-e:m4a] [-e:m4b] [--authcode <AUTHCODE>] [--no-clobber]\n[--target_dir <PATH>] [--complete_dir <PATH>] [--validate]\n[--continue <CHAPTERNUMBER>] [--keep-artist <N>] [--author <AUTHOR>] {FILES}\n'
|
||||||
codec=libmp3lame # Default encoder.
|
codec=libmp3lame # Default encoder.
|
||||||
extension=mp3 # Default encoder extension.
|
extension=mp3 # Default encoder extension.
|
||||||
level=-1 # Compression level. Can be given for mp3, flac and opus. -1 = default/not specified.
|
level=-1 # Compression level. Can be given for mp3, flac and opus. -1 = default/not specified.
|
||||||
@ -20,6 +20,7 @@ noclobber=0 # Default off, clobber only if flag is enabled
|
|||||||
continue=0 # Default off, If set Transcoding is skipped and chapter splitting starts at chapter continueAt.
|
continue=0 # Default off, If set Transcoding is skipped and chapter splitting starts at chapter continueAt.
|
||||||
continueAt=1 # Optional chapter to continue splitting the chapters.
|
continueAt=1 # Optional chapter to continue splitting the chapters.
|
||||||
keepArtist=-1 # Default off, if set change artist metadata to use the passed argument as field
|
keepArtist=-1 # Default off, if set change artist metadata to use the passed argument as field
|
||||||
|
authorOverride= # Override the author, ignoring the metadata
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# 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
|
||||||
@ -62,6 +63,8 @@ while true; do
|
|||||||
--level ) level="$2"; shift 2 ;;
|
--level ) level="$2"; shift 2 ;;
|
||||||
# Keep artist number n
|
# Keep artist number n
|
||||||
--keep-artist ) keepArtist="$2"; shift 2 ;;
|
--keep-artist ) keepArtist="$2"; shift 2 ;;
|
||||||
|
# Author override
|
||||||
|
--author ) authorOverride="$2"; shift 2 ;;
|
||||||
# Command synopsis.
|
# Command synopsis.
|
||||||
-h | --help ) printf "$usage" $0 ; exit ;;
|
-h | --help ) printf "$usage" $0 ; exit ;;
|
||||||
# Standard flag signifying the end of command line processing.
|
# Standard flag signifying the end of command line processing.
|
||||||
@ -144,7 +147,7 @@ log() {
|
|||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Print out what we have already after command line processing.
|
# Print out what we have already after command line processing.
|
||||||
debug_vars "Command line options as set" codec extension mode container targetdir completedir auth_code
|
debug_vars "Command line options as set" codec extension mode container targetdir completedir auth_code keepArtist authorOverride
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# Variable validation
|
# Variable validation
|
||||||
@ -413,13 +416,19 @@ do
|
|||||||
# Make sure everything is a variable. Simplifying Command interpretation
|
# Make sure everything is a variable. Simplifying Command interpretation
|
||||||
save_metadata "${aax_file}"
|
save_metadata "${aax_file}"
|
||||||
genre=$(get_metadata_value genre)
|
genre=$(get_metadata_value genre)
|
||||||
if [ "${keepArtist}" != "-1" ]; then
|
if [ "x${authorOverride}" != "x" ]; then
|
||||||
# sed command: 'C. S. Lewis' -> 'C.S. Lewis'
|
#Override
|
||||||
artist=$(get_metadata_value artist | cut -d',' -f"$keepArtist" | $SED -E 's|\. +|\.|g; s|((\w+\.)+)|\1 |g')
|
artist="${authorOverride}"
|
||||||
album_artist="$(get_metadata_value album_artist | cut -d',' -f"$keepArtist" | $SED -E 's|\. +|\.|g; s|((\w+\.)+)|\1 |g')"
|
album_artist="${authorOverride}"
|
||||||
else
|
else
|
||||||
artist=$(get_metadata_value artist)
|
if [ "${keepArtist}" != "-1" ]; then
|
||||||
album_artist="$(get_metadata_value album_artist)"
|
# sed command: 'C. S. Lewis' -> 'C.S. Lewis'
|
||||||
|
artist=$(get_metadata_value artist | cut -d',' -f"$keepArtist" | $SED -E 's|\. +|\.|g; s|((\w+\.)+)|\1 |g')
|
||||||
|
album_artist="$(get_metadata_value album_artist | cut -d',' -f"$keepArtist" | $SED -E 's|\. +|\.|g; s|((\w+\.)+)|\1 |g')"
|
||||||
|
else
|
||||||
|
artist=$(get_metadata_value artist)
|
||||||
|
album_artist="$(get_metadata_value album_artist)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
title=$(get_metadata_value title | $SED 's/'\:'/'-'/g' | $SED 's/- /-/g' | xargs -0)
|
title=$(get_metadata_value title | $SED 's/'\:'/'-'/g' | $SED 's/- /-/g' | xargs -0)
|
||||||
title=${title:0:100}
|
title=${title:0:100}
|
||||||
|
@ -52,6 +52,7 @@ bash AAXtoMP3 [-f|--flac] [-o|--opus] [-a|-aac] [-s|--single] [--level <COMPRESS
|
|||||||
* **--continue <CHAPTERNUMBER>** 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 <CHAPTERNUMBER>" where CHAPTERNUMBER is the chapter that got interrupted.
|
* **--continue <CHAPTERNUMBER>** 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 <CHAPTERNUMBER>" where CHAPTERNUMBER is the chapter that got interrupted.
|
||||||
* **--level <COMPRESSIONLEVEL>** Set compression level. May be given for mp3, flac and opus.
|
* **--level <COMPRESSIONLEVEL>** Set compression level. May be given for mp3, flac and opus.
|
||||||
* **--keep-artist <FIELD>** If a book has multiple authors and you don't want all of them in the metadata, with this flag you can specify a specific author (1 is the first, 2 is the second...) to keep while discarding the others.
|
* **--keep-artist <FIELD>** If a book has multiple authors and you don't want all of them in the metadata, with this flag you can specify a specific author (1 is the first, 2 is the second...) to keep while discarding the others.
|
||||||
|
* **--author <AUTHOR>** Manually set the author metadata field, useful if you have multiple books of the same author but the name reported is different (eg. spacing, accents..)
|
||||||
|
|
||||||
|
|
||||||
### [AUTHCODE]
|
### [AUTHCODE]
|
||||||
|
Loading…
Reference in New Issue
Block a user