Last active
September 16, 2015 13:09
-
-
Save nemanjan00/7b3c30fcbc0a985646b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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