The simplest submit script


I'm running MOC on OpenWRT which has very limited resources, so I needed a really simple scrobbling mechanism. On normal machines I just use Better behaved submission to, but on OpenWRT I wanted to get rid of python. 30MB of RAM is not a lot ;-)

The script I use still depends on lastfmsubmitd which is written in Python, but I run it on a different machine and export /var/spool/lastfm via nfs.

This script is really simple, I'm only posting it here to let you know that it is possible to do it _that_ simple :) I didn't add any thing like "wait for 50% of the track before submitting", I just submit as soon as playback starts. Anyone could just add a pause and a check if he needs it. It's also not very secure and error resistant, but it just does the trick.

OnSongChange = "/path/.moc/ %a %t %d %r"

pli=`mktemp -p /tmp/`
chmod 666 $pli
echo "---" > $pli
echo "album: $4" >> $pli
echo "length: $3" >> $pli
echo "title: $2" >> $pli
echo "time: !timestamp" `date "+%F %T"` >> $pli
echo "artist: $1" >>$pli
mv $pli [path to mounted /var/spool/lastfm]