From 41b729acd303ff1180ca2e1a9ab9e0b05a0e4c29 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Thu, 22 Sep 2022 12:52:04 +0000 Subject: [PATCH] Fix tag script mp3 issue (#1182) * 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. * Remove double backslash --- .local/bin/tag | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.local/bin/tag b/.local/bin/tag index 8462b99..11a5b8e 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