SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-10-26 09:31:17

ErSandro
#! CrunchBanger
Registered: 2009-09-19
Posts: 108

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
done

It's quite simple, the output looks like this:

PLAY:::Artist: Bob Marley & the Wailers:::Album: Legend:::SongTitle: Jammin':::00:11/03:33

To 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)

Offline

Help fund CrunchBang, donate to the project!

#2 2011-10-26 09:37:37

el_koraco
#!/loony/bun
From: inside Ed
Registered: 2011-07-25
Posts: 4,749

Re: MOC status

Nice one. Plus, another scrowtm junkie big_smile
The next version of #! should probably have scrotwm installed by default, so people can choose it from GDM.

Offline

#3 2011-10-26 09:58:49

ErSandro
#! CrunchBanger
Registered: 2009-09-19
Posts: 108

Re: MOC status

Always loved tiling wink

Normally I prefer manual tiling, but scrotwm is my favourite auto tiling WM. Especially now, the new version made possible to lower/raise clients and that's sooo cool. Now with scrotwm I can do anything I used to do with musca and much more.

Indeed it's a nice piece of software.

Offline

#4 2011-10-26 10:53:18

h8uthemost
#! Junkie
Registered: 2011-08-09
Posts: 293

Re: MOC status

I've actually been using this string to get the Artist - Track to show up in the Scrotbar through Conky:

${exec mocp -Q %artist} - ${exec mocp -Q %song}

But your script is more informative. I'll definitely have to try this out. Thanks ErSandro. smile


We are a nice, friendly community here and I hope we stay that way.

Offline

#5 2011-10-26 11:44:08

ErSandro
#! CrunchBanger
Registered: 2009-09-19
Posts: 108

Re: MOC status

^You're right, i slighlty modified the script.

#!/bin/bash
SLEEP=1
while :; do

        STATE=`mocp -Q %state`

        if [[ $STATE = "STOP" ]]; 
                then
                echo "MOC Stopped"

                else
                ARTIST=`mocp -Q %artist`
                TITLE=`mocp -Q %song`
                ALBUM=`mocp -Q %album`
                CTIME=`mocp -Q %ct`
                TTIME=`mocp -Q %tt`
                echo "$STATE:::Artist - $ARTIST:::Album - $ALBUM:::Title - $TITLE:::Time - $CTIME/$TTIME"
        fi

sleep $SLEEP
done

Now the ouptut looks like this:

PAUSE:::Artist - Bob Marley & the Wailers:::Album - Legend:::Title - Satisfy My Soul:::Time - 02:36/04:33

Thanks for the advice.

Last edited by ErSandro (2011-10-26 11:45:41)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo