Song: Remove duplicate blocks

This commit is contained in:
Dylan Araps 2016-12-15 23:29:34 +11:00
parent 98d2421b8b
commit ca8c45b668
1 changed files with 8 additions and 24 deletions

View File

@ -1219,32 +1219,16 @@ get_song() {
song="$(audtool current-song)"
;;
"gnome-music"*)
"gnome-music"* | "lollypop"* | "clementine"*)
case "$player" in
"gnome-music"*) player="GnomeMusic" ;;
"lollypop"*) player="Lollypop" ;;
"clementine"*) player="clementine" ;;
esac
# Hello dbus my old friend.
song="$(\
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.GnomeMusic /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\
awk -F '"' '/artist|title/ {printf $2 " - "}'
)"
song="${song% - }"
;;
"lollypop"*)
# Hello dbus my old friend.
song="$(\
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\
awk -F '"' '/artist|title/ {printf $2 " - "}'
)"
song="${song% - }"
;;
"clementine"*)
# dbus
song="$(
dbus-send --print-reply --dest=org.mpris.clementine /org/mpris/MediaPlayer2 \
dbus-send --print-reply --dest=org.mpris.MediaPlayer2."${player}" /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\
awk -F '"' '/artist|title/ {printf $2 " - "}'