From 2cc7ec8450f96e4a38bffacaf4fb48ff895375c3 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Thu, 13 Apr 2023 22:05:09 -0400 Subject: [PATCH] tag.sh: add track option --- src/.local/bin/tag.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/.local/bin/tag.sh b/src/.local/bin/tag.sh index 4caf40a..162ae89 100755 --- a/src/.local/bin/tag.sh +++ b/src/.local/bin/tag.sh @@ -5,9 +5,14 @@ cat "$TMPFILE" | while read line; do link="$(echo $line | awk -F";" '{print $1}')" artist="$(echo $line | awk -F";" '{print $2}')" alb="$(echo $line | awk -F";" '{print $3}')" - file="$artist-$alb" + trk="$(echo $line | awk -F";" '{print $4}')" + file="$artist-$alb-$trk" yt-dlp "$link" -x --audio-format mp3 --no-playlist -o "$file.%(ext)s" mid3v2 -a "$artist" "$file"* mid3v2 -A "$alb" "$file"* - mid3v2 -t "$alb" "$file"* + if [ -z "$trk" ]; then + mid3v2 -t "$alb" "$file"* + else + mid3v2 -t "$trk" "$file"* + fi done