Added support for Rhythmbox Music Player

This commit is contained in:
Muhammad Herdiansyah 2016-09-04 19:06:28 +07:00
parent de96b1106f
commit 8c459ba781

View file

@ -1223,16 +1223,24 @@ getsong() {
song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " & name of current track as string')"
state="$(osascript -e 'tell application "iTunes" to player state as string')"
elif [ -n "$(ps x | awk '!(/awk/) && /rhythmbox/')" ]; then
song="$(rhythmbox-client --print-playing)"
# Well, what can you expect? It's dbus after all.
state="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\
awk -F 'string "' '{printf $2}')"
state="${state//\"}"
else
song="Not Playing"
fi
case "$state" in
"paused" | "PAUSE")
"paused" | "PAUSE" | "Paused")
song="Paused"
;;
"stopped" | "STOP")
"stopped" | "STOP" | "Stopped")
song="Stopped"
;;
esac