Skip to content

Instantly share code, notes, and snippets.

@nemanjan00
Last active September 16, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemanjan00/7b3c30fcbc0a985646b7 to your computer and use it in GitHub Desktop.
Save nemanjan00/7b3c30fcbc0a985646b7 to your computer and use it in GitHub Desktop.
album=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$`
artist=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$`
title=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$`
mpsyt=`(pgrep mplayer | xargs ps -o command | grep -o -P '(?<=-title ).*(?= -noquiet)') | head -n 1 | cut -c1-40`
spotify="$artist - $title"
echo -n '#[fg=$tm_color_music]'
if [ ! -z "$title" -a "$title"!=" " ]; then
echo -n "♫ $spotify "
fi
if [ ! -z "$mpsyt" -a "$mpsyt"!=" " ]; then
echo -n " ♫ $mpsyt... "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment