awk: Match exactly "album", not "albumArtist"

This commit is contained in:
xPMo 2018-09-10 17:03:18 -05:00 committed by Michael Straube
parent 92c3ad7493
commit 90ddcbd3e1

View file

@ -2373,7 +2373,7 @@ get_song() {
dbus-send --print-reply --dest=org.mpris.MediaPlayer2."${1}" /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' \
string:'Metadata' |\
awk -F '"' 'BEGIN {RS=" entry"}; /xesam:artist/ {a = $4} /xesam:album/ {b = $4}
awk -F '"' 'BEGIN {RS=" entry"}; /"xesam:artist"/ {a = $4} /"xesam:album"/ {b = $4}
/xesam:title/ {t = $4} END {print a "\n" b "\n" t}'
)"
}
@ -2453,26 +2453,15 @@ get_song() {
"quodlibet"*)
song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \
/net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\
awk -F'"' '/artist/ {getline; a=$2} /album/ {getline; b=$2}
/title/ {getline; t=$2} END {print a "\n" b "\n" t}')"
awk -F'"' 'BEGIN {RS=" entry"}; /"artist"/ {a=$4} /"album"/ {b=$4}
/"title"/ {t=$4} END {print a "\n" b "\n" t}')"
;;
"pogo"*)
song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \
org.freedesktop.MediaPlayer.GetMetadata |
awk -F'"' '/string "artist"/ {
getline;
a=$2
}
/string "album"/ {
getline;
b=$2
}
/string "title"/ {
getline;
t=$2
}
END {print a "\n" b "\n" t}')"
awk -F'"' 'BEGIN {RS=" entry"}; /"artist"/ {a=$4} /"album"/ {b=$4}
/"title"/ {t=$4} END {print a "\n" b "\n" t}')"
;;
*) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" ;;