Topic: MOC status
I just wanted to share a little script I'm using in scrotwm to display moc status in the bar.
#!/bin/bash
SLEEP=1
while :; do
STATE=`mocp --info | grep State | cut -d" " -f2`
if [[ $STATE = "STOP" ]];
then
echo "MOC Stopped"
else
ARTIST=`mocp --info | grep Artist`
TITLE=`mocp --info | grep SongTitle`
ALBUM=`mocp --info | grep Album`
CTIME=`mocp --info | grep CurrentTime | cut -d" " -f2`
TTIME=`mocp --info | grep TotalTime | cut -d" " -f2`
echo "$STATE:::$ARTIST:::$ALBUM:::$TITLE:::$CTIME/$TTIME"
fi
sleep $SLEEP
doneIt's quite simple, the output looks like this:
PLAY:::Artist: Bob Marley & the Wailers:::Album: Legend:::SongTitle: Jammin':::00:11/03:33To have a correct output be sure that the mocp server is up when the script is running or add a condition to manage the case of a server down.
Cheers.
Last edited by ErSandro (2011-10-26 09:33:15)