Yet another submit script


I wanted to scrobble songs through the official client instead of via lastfmsubmitd, so that I could get song/artist/album info in the client and have audio fingerprints submitted to

I tried to use fagga's mocstat script, but I found it easier to hack the relevant logic in the script instead of using the available hooks. Also, I had a few problems to make it work correctly, so I deleted some parts of the code and added some "utf8" declarations - now it only sends commands to the client, and it may not work right with non-Unicode locales. Of course all this can be added to the original script, but I only had time for a quick hack - sorry...

So, here it is:

I use it through the following shell function:

m () { 
    if [ -z "`pgrep -x`" ]; then
        lastfm -tray &
    if [ -z "`pgrep -f moc-lastfm`" ]; then
        ~/.bin/ >> ~/.mocstat/moc-lastfm.log 2>&1 &
    mocp "$@"