Stable: 2.5.2
Development: 2.6-alpha3
Hello there,
I wrote a little perl script called mocstat that implements some kind of song change and general status information functionality. It runs in the background and invokes continuously (every 500ms) "mocp --info". The gathered status information will be submitted to two scripts via environment variables.
[br]
Here is an example for ~/.mocstat/update:
#!/bin/sh
echo -e "$TITLE" > ~/.conky/mocstat.title
echo -e "$CURRENTTIME" > ~/.conky/mocstat.currenttime
echo -e "$TOTALTIME" > ~/.conky/mocstat.totaltime
echo -e "$PERCENTDONE" > ~/.conky/mocstat.percentdone
This puts the status information in some FIFOs which I can read in my conkyrc via ${exec cat ~/.conky/mocstat.title} or ${execbar cat ~/.conky/mocstat.percentdone} or something like this.
I use FIFOs because normal files are sometimes empty when conky reads them which makes the display flickering. By using a FIFO, conky hangs until there is something to read. (Create a FIFO with mknod or mkfifo.)
[br]
Here is an example for ~/.mocstat/songchange to scrobble your music to last.fm via lastfmsubmitd:
#!/bin/sh
if [ -n "$ARTIST" ] && [ -n "$SONGTITLE" ] && [ -n "$TOTALTIME" ]; then
/usr/lib/lastfmsubmitd/lastfmsubmit --encoding UTF-8 --artist "$ARTIST" --title "$SONGTITLE" --length "$TOTALTIME" --album "$ALBUM"
fi
If the necessary information for scrobbling (artist, title and length) is available, submit it to lastfmsubmitd which will make sure it gets to last.fm.
[br]
When you run this script for the first time, it creates ~/.mocstat/ automatically. You can then create and edit ~/.mocstat/update and/or ~/.mocstat/songchange. And don't forget to make them executable.
I put mocstat & in my ~/.xsession, so it gets started when I log in and works silently in the background.
And finally the download link: http://www.sendspace.com/file/hypep2
Feel free to send any constructive feedback to fagga@gmx.de.
daper
Sat, 2007-02-10 14:45
Permalink
Nice solution until running
Nice solution until running external scripts by MOC on events will appear. I see the script properly handles it's restart without losing it's state.
--
Damian Pietras - MOC developer
TheMoken
Thu, 2007-03-01 04:37
Permalink
In SVN (soon)
I submitted a patch that calls an executable with some escapable arguments on song change. After we get any bugs/style stuff ironed out (i.e. soon), it'll be in SVN.
cha5on
Fri, 2007-06-08 05:13
Permalink
Repost please.
The download link is gone, please repost :)
fagga
Sat, 2007-06-16 22:56
Permalink
New download link
I re-uploaded the script, but nobody knows when the link will be dead again. Does anyone know a good free file hosting provider? Or maybe it could be stored somewhere on this site?
Here is the new download link:
http://z05.zupload.com/download.php?file=getfile&filepath=10333
daper
Sun, 2007-06-17 15:49
Permalink
I should have done this long
I should have done this long before but here it is:
http://moc.daper.net/contrib
--
Damian Pietras - MOC developer
rastiazul
Thu, 2007-09-13 03:54
Permalink
help
how do you run the script?