[Linux] Added spotify support to getsong
This commit is contained in:
parent
554d65de82
commit
73b0e4c786
17
neofetch
17
neofetch
|
@ -1075,6 +1075,21 @@ getsong () {
|
|||
song="$(mocp -Q "%artist - %song" 2>/dev/null)"
|
||||
state="$(mocp -Q "%state" 2>/dev/null)"
|
||||
|
||||
elif pgrep "spotify" >/dev/null 2>&1; then
|
||||
case "$os" in
|
||||
"Linux")
|
||||
# This command is way too long
|
||||
song="$(\
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /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=${song/'('*}
|
||||
song=${song//'['*}
|
||||
;;
|
||||
esac
|
||||
else
|
||||
song="Unknown"
|
||||
fi
|
||||
|
@ -1084,7 +1099,7 @@ getsong () {
|
|||
song="Paused"
|
||||
;;
|
||||
|
||||
"stopped" | "STOP" | "")
|
||||
"stopped" | "STOP")
|
||||
song="Stopped"
|
||||
;;
|
||||
esac
|
||||
|
|
Reference in New Issue