Merge pull request #440 from konimex/music

Music: Added support for various music players
This commit is contained in:
Dylan Araps 2016-11-16 10:57:00 +11:00 committed by GitHub
commit cd6a10206f

View file

@ -1076,7 +1076,7 @@ get_memory() {
get_song() { get_song() {
# This is absurdly long. # This is absurdly long.
player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious/ {printf $5 " " $6; exit}')" player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|gnome-music|lollypop/ {printf $5 " " $6; exit}')"
case "${player/*\/}" in case "${player/*\/}" in
"mpd"*) "mpd"*)
@ -1160,6 +1160,28 @@ get_song() {
song="$(audtool current-song)" song="$(audtool current-song)"
;; ;;
"gnome-music"*)
# 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% - }"
;;
*) song="Not Playing" ;; *) song="Not Playing" ;;
esac esac