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
1 changed files with 5 additions and 16 deletions

View File

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