song: Fix issues with non-english tags
This commit is contained in:
parent
6c966b05ae
commit
8a96fd545d
24
neofetch
24
neofetch
|
@ -2467,22 +2467,28 @@ get_song() {
|
||||||
/"title"/ {t=$4} END {print a "\n" b "\n" t}')"
|
/"title"/ {t=$4} END {print a "\n" b "\n" t}')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" ;;
|
*) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" || return ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ "$song" != *[a-z]* ]] && { unset -v song; return; }
|
|
||||||
|
|
||||||
IFS=$'\n' read -d "" -r artist album title <<< "$song"
|
IFS=$'\n' read -d "" -r artist album title <<< "$song"
|
||||||
|
|
||||||
|
# Make sure empty tags are truly empty.
|
||||||
|
artist="$(trim "$artist")"
|
||||||
|
album="$(trim "$album")"
|
||||||
|
title="$(trim "$title")"
|
||||||
|
|
||||||
|
# Set default values if no tags were found.
|
||||||
|
: "${artist:=Unknown Artist}" "${album:=Unknown Album}" "${title:=Unknown Song}"
|
||||||
|
|
||||||
# Display Artist, Album and Title on separate lines.
|
# Display Artist, Album and Title on separate lines.
|
||||||
if [[ "$song_shorthand" == "on" ]]; then
|
if [[ "$song_shorthand" == "on" ]]; then
|
||||||
[[ "$(trim "$artist")" ]] && prin "Artist" "$artist"
|
prin "Artist" "$artist"
|
||||||
[[ "$(trim "$album")" ]] && prin "Album" "$album"
|
prin "Album" "$album"
|
||||||
[[ "$(trim "$song")" ]] && prin "Song" "$title"
|
prin "Song" "$title"
|
||||||
else
|
else
|
||||||
song="${song_format/\%artist\%/${artist}}"
|
song="${song_format/\%artist\%/$artist}"
|
||||||
song="${song/\%album\%/${album}}"
|
song="${song/\%album\%/$album}"
|
||||||
song="${song/\%title\%/${title}}"
|
song="${song/\%title\%/$title}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue