Created
January 3, 2017 05:21
-
-
Save jackinloadup/f13288ee298fae7af7157451a7460d56 to your computer and use it in GitHub Desktop.
mopidy for i3blocks
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
#!/bin/bash | |
# | |
# Author: Raphael P. Ribeiro <[email protected]> | |
MPCSTAT=`mpc | grep -v '^volume:'` | |
if [ -z "${MPCSTAT}" ]; then # if not playing, exit | |
echo "$line" || exit 1 | |
else | |
if [ $1 == '1' ]; then # if arg = 1, show music symbols | |
MPCSTAT2=`echo "${MPCSTAT}" | sed 's, *, ,g; 1h;1d;2G' | head -n1 | cut -d ']' -f 1 | tr -d [` | |
PLAY="" | |
PAUSE="" | |
[ "$MPCSTAT2" = "playing" ] && echo $PLAY || echo $PAUSE | |
else # else, show what's playing | |
PLAYING=`echo "${MPCSTAT}" | sed 's, *, ,g; 1h;1d;2G' | paste -d' ' -s - | cut -d ')' -f2` | |
TIME=`echo "${MPCSTAT}" | sed 's, *, ,g; 1h;1d;2G' | paste -d' ' -s - | head -n1 | cut -d ' ' -f3` | |
echo "$PLAYING ($TIME)" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment