commit dce56bcb4add96ed9a1aa0d856c85afd409ef4a5
parent 8f8094dc6e58d228286d85df97c16d5de66a42e5
Author: Alex Balgavy <alex@balgavy.eu>
Date: Wed, 10 Aug 2022 00:00:03 +0200
audiotag: add image parameter
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/scripts/audiotag b/scripts/audiotag
@@ -27,6 +27,10 @@ while [ $(($#)) -ne 0 ]; do
number="$2"
shift 2
;;
+ -i|--image)
+ image="$2"
+ shift 2
+ ;;
-x|--extract)
spec="$2"
shift 2
@@ -37,7 +41,7 @@ while [ $(($#)) -ne 0 ]; do
;;
-h|--help)
printf 'Supported usage\n'
- printf '%s -b albumartist -t title -l album -r artist -n tracknumber FILE\n' "$0"
+ printf '%s -b albumartist -t title -l album -r artist -n tracknumber -i IMG_PATH:DESCRIPTION \n' "$0"
printf '%s [--extract|-x] "filename_spec" FILE\n' "$0"
printf '%s [--clear|-c] FILE\n' "$0"
exit 0
@@ -85,6 +89,12 @@ printf '%s\n' "$FILES" | while IFS='' read -r file; do
[ -n "$album" ] && set -- "$@" -A "$album"
[ -n "$artist" ] && set -- "$@" -a "$artist"
[ -n "$number" ] && set -- "$@" -n "$number"
+
+ if [ -n "$image" ]; then
+ img_path="${image%%:*}"
+ img_desc="${image##*:}"
+ set -- "$@" --add-image "${img_path}:FRONT_COVER:${img_desc}"
+ fi
eyeD3 "$@" "$file"
fi
;;
@@ -125,6 +135,12 @@ printf '%s\n' "$FILES" | while IFS='' read -r file; do
[ -n "$artist" ] && set -- "$@" --set-tag=ARTIST="$artist"
[ -n "$number" ] && set -- "$@" --set-tag=TRACKNUMBER "$number"
+ if [ -n "$image" ]; then
+ img_path="${image%%:*}"
+ img_desc="${image##*:}"
+ set -- "$@" --import-picture-from="3||${img_desc}||${img_path}"
+ fi
+
metaflac "$@" "$file"
fi
;;