mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
keep n-th artist only
This commit is contained in:
parent
440c6302fb
commit
ad86f187f8
13
AAXtoMP3
13
AAXtoMP3
@ -5,7 +5,7 @@
|
||||
# Command Line Options
|
||||
|
||||
# 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>]{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>] {FILES}\n'
|
||||
codec=libmp3lame # Default encoder.
|
||||
extension=mp3 # Default encoder extension.
|
||||
level=-1 # Compression level. Can be given for mp3, flac and opus. -1 = default/not specified.
|
||||
@ -19,6 +19,7 @@ DEBUG=0 # Default off, If set extremely verbose output.
|
||||
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.
|
||||
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
|
||||
|
||||
# -----
|
||||
# Code tip Do not have any script above this point that calls a function or a binary. If you do
|
||||
@ -59,6 +60,8 @@ while true; do
|
||||
--continue ) continueAt="$2"; continue=1; shift 2 ;;
|
||||
# Compression level
|
||||
--level ) level="$2"; shift 2 ;;
|
||||
# Keep artist number n
|
||||
--keep-artist ) keepArtist="$2"; shift 2 ;;
|
||||
# Command synopsis.
|
||||
-h | --help ) printf "$usage" $0 ; exit ;;
|
||||
# Standard flag signifying the end of command line processing.
|
||||
@ -410,7 +413,14 @@ do
|
||||
# Make sure everything is a variable. Simplifying Command interpretation
|
||||
save_metadata "${aax_file}"
|
||||
genre=$(get_metadata_value genre)
|
||||
if [ "${keepArtist}" != "-1" ]; then
|
||||
# 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+\.)')"
|
||||
else
|
||||
artist=$(get_metadata_value artist)
|
||||
album_artist="$(get_metadata_value album_artist)"
|
||||
fi
|
||||
title=$(get_metadata_value title | $SED 's/'\:'/'-'/g' | $SED 's/- /-/g' | xargs -0)
|
||||
title=${title:0:100}
|
||||
if [ "x${targetdir}" != "x" ] ; then
|
||||
@ -420,7 +430,6 @@ do
|
||||
fi
|
||||
output_file="${output_directory}/${title}.${extension}"
|
||||
bitrate="$(get_bitrate)k"
|
||||
album_artist="$(get_metadata_value album_artist)"
|
||||
album="$(get_metadata_value album)"
|
||||
album_date="$(get_metadata_value date)"
|
||||
copyright="$(get_metadata_value copyright)"
|
||||
|
@ -51,6 +51,7 @@ 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.
|
||||
* **--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.
|
||||
* **--keep-artist <FIELD>** In case you don't want to keep all the authors in the metadata, with this flag you can specify a specific field (1 is the first, 2 is the second...)
|
||||
|
||||
|
||||
### [AUTHCODE]
|
||||
|
Loading…
Reference in New Issue
Block a user