lastfmsubmitd on Ubuntu Dapper

June 07, 2007 [Tech]

So I had been thinking about putting last.fm support into GSSMP, and then I got an email to the mailing list suggesting it, and then I couldn't sleep tonight, and, as ever, something that sounded easy has turned into a saga.

I decided to use lastfmsubmitd to handle communicating with last.fm, since it seems silly to re-implement this in every app, and, after worrying that the web site didn't mention any binary packages, I was glad to discover that it has indeed been packaged for Ubuntu Edgy, Feisty and Gutsy.

Of course, since I use an distro version that is *gasp* almost ONE YEAR OLD (Ubuntu Dapper) there were no packages for my version.

So I downloaded the Edgy version and tried to install it, but it complained that my version of python-support was too old.

After quite a bit of faffing I extracted the .deb file using ar (1), and then untarred the file inside there called control.tar.gz and edited the file inside there called control so that it said python-support (>= 0.1) instead of 0.2. Simple, eh?

[Of course, all of this assumes that the packager had no good reason for asking for version 0.2. So far, it looks like that assumption was correct.]

After some careful re-tarring and re-arring (if that's a word) I had a new .deb, which you can download if you're interested, from here: lastfmsubmitd_0.32.1-1-friggedbyandy_all.deb which appears to install cleanly (so long as I create a config file /etc/lastfmsubmitd.conf BEFORE I install...).

That config file, by the way, just looks like this:

[account]
password = mypassword
user = myusername

and is owned by the lastfm user, in the root group, and is not readable by "all". Note that you can't make it owned by the lastfm user until after you've installed the deb, because that user won't exist until then.

Are you following so far?

Of course, for some unknown reason that deb only contains the daemon lastfmsubmitd, and not the helper program lastfmsubmit, which allows you to actually submit tracks on the command line, despite the fact that the deb installs the man page for that command.

So, I downloaded the relevant original source package, and just extracted the file lastfmsubmit and put it in my PATH.

After executing a simple command like this:

sudo chmod a+w /var/spool/lastfm

(obviously) it seems to actually work when I run from the command line like so:

lastfmsubmit --artist "Propellerheads" --album "Decksandrumsandrockandroll" --title "A Number of Microphones" --length "45"

Now on to doing what I actually wanted to do...

Update: note also the bug in these packages that prevents cron.daily from running: Ubuntu 136717