Yet another Last.fm submit script

Forums:

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

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 last.fm 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:

http://members.hellug.gr/adia/m/moc-lastfm.pl

I use it through the following shell function:

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