fix trailing whitespace in vorbis comments

This commit is contained in:
Lorenzo Pistone 2019-02-19 13:00:36 +01:00
parent 6d11933999
commit f7b0e2f17d
1 changed files with 9 additions and 8 deletions

17
tag_ogg
View File

@ -1,19 +1,20 @@
#!/bin/sh #!/bin/bash
set -e set -e
fname=$(echo "${4} - ${2}.ogg" | tr '/' -) fname="${4} - ${2}.ogg"
cat > "$fname" fname="${fname//\//-}"
echo "$fname" cat > "${fname}"
echo "${fname}"
{ {
echo "SPOTIFY_ID=${1}" echo "SPOTIFY_ID=${1}"
title=$(tr '\n' ' ' <<< "${2}") title="${2//'\n'/' '}"
album=$(tr '\n' ' ' <<< "${3}") album="${3//'\n'/' '}"
echo "TITLE=${title}" echo "TITLE=${title}"
echo "ALBUM=${album}" echo "ALBUM=${album}"
shift 3 shift 3
for artist in "$@"; do for artist in "$@"; do
artist=$(tr '\n' ' ' <<< "${artist}") artist="${artist//'\n'/' '}"
echo "ARTIST=${artist}" echo "ARTIST=${artist}"
done done
} | vorbiscomment -a "$fname" } | vorbiscomment -a "${fname}"