From 8566a9a5d733b9ed87ffd46efab930adfdf4d6b2 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Sat, 3 Sep 2022 21:06:53 +0000 Subject: [PATCH] Fix tag script mp3 issue When you don't manually specify $total and $date with an mp3 file the eyeD3 command tries tagging with an empty variable, which causes it to error. This fixes it by only passing the parameter to the command if the variable is set. This pull request also adds support for the $genre and $comment variable. --- .local/bin/tag | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.local/bin/tag b/.local/bin/tag index 8462b99a..a55bbaec 100755 --- a/.local/bin/tag +++ b/.local/bin/tag @@ -54,7 +54,11 @@ Total=$total Date=$date Genre=$genre Comment=$comment" | opustags -i -S "$file" ;; - *.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;; + *.mp3) eyeD3 -Q --remove-all -a "$artist" -t "$title" -A "$album" -n "$track" \\ + ${total:+-N "$total"} \\ + ${date:+-Y "$date"} \\ + ${genre:+-G "$genre"} \\ + ${comment:+-c "$comment"} "$file" ;; *.flac) echo "TITLE=$title ARTIST=$artist ALBUM=$album