Sunday, March 19, 2006

OK, I've finally come up with a workable solution, for last.fm, and using XMMS/winamp, and my ipod.

Setting the time back on my ipod didn't work, because the clock is fixed when I attach it to a machine. Therefor yamipod, without being fixed, is no good.

I found another thing, called "audiopod goes iscrobbler". It reads the play counts file off the ipod, and will drop the entries into the winamp cache.

This will work fine at work, when I get in, I can connect my ipod, run the program, then start winamp, and my tracks will be timezone adjusted, and submitted.

I can then listen to music at work with winamp, and the data will be submitted.

When I get home, there would have been an issue. If I'd used XMMS, then I wouldn't be able to submit the music from the trip home, from my ipod.

I went about setting up a similar arrangement to work, using winamp and the plugin, so I could use "audiopod goes iscrobbler" at home.

First I was thinking that I needed to be able to connect the ipod to the windows VM. I shutdown the instance running, added a USB controller to it, and restarted it.

I then attached the ipod to the machine running vmware, and attached the ipod to the USB port in the VM. It was complaining that the ipod had already been attached to, by "usb-storage".

I unloaded the kernel module, and the I was able to attach it to the VM. Windows, running in the VM, detected it, complained that a high speed device was attached to a low speed port, and did nothing more.

It didn't mount it, and it didn't give me any access to it. I googled around a bit, and found that it's something to do with VMware not supporting USB2.0 properly, and also something to do with the linux kernel, which requires a patch.

Ugh. I then realised that I didn't actually need the ipod connected directly to the VM, since it just ends up with a drive letter, and accesses it through that.

I attached the ipod to my laptop as usual, created a symlink in my SMB shared home directory, to the mount point for the ipod, and then mapped a drive in the VM, to the shared ipod mount directory.

I was then able to run "audiopod goes iscrobbler" from the ipod, which read the DB, and then put the data into the cache file for winamp, in the VM.

I started up winamp, and it submitted the data. I was seeing lots of references to "BADAUTH" in the log file, but it had submitted the tracks anyway.

I just used it again, and it seemed to work, but I'm not sure if it failed to submit some tracks. I submitted the ones that I thought were missing again, and then it told me that they weren't accepted, because they weren't played latest, but the missing ones were listed at that point.

Maybe there's just a delay between some submissions, and them showing up in the recently played list.

Now it would just be nice if the "spam protection" on last.fm was a bit smarter, and would allow me to submit data out of order, and not force me to submit the tracks from my ipod before I play a song with XMMS or winamp.

Wednesday, March 15, 2006

Whenever I search for music, I keep seeing results on google in reference to "last.fm".

It's an online charts thing, and it looks like the people who use it have some reasonable taste in music. The crap you hear on the radio was no where to be seen in the charts.

I decided to see what linux support was like. I was surprised to find that there's an XMMS plugin, and several other linux players, like amarok support it.

I decided to build the xmms plugin. I downloaded it, and went about configuring it. Here's the output:


checking for glib-config... no
checking for GLIB - version >= 1.2.2... no
*** The glib-config script installed by GLIB could not be found
*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GLIB_CONFIG environment variable to the
*** full path to glib-config.
configure: WARNING: *** GLIB >= 1.2.2 not installed - please install first ***


It seems that it can't find glib-config. I checked packages.ubunutu, and found I needed to install libglib1.2-dev.


checking for xmms-config... no
checking for XMMS - version >= 1.2.4... no
*** The xmms-config script installed by XMMS could not be found.
*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the XMMS_CONFIG environment variable to the
*** full path to xmms-config.
configure: WARNING: *** XMMS >= 1.2.4 not installed - please install first ***


Like above, I needed to install xmms-dev, no biggie.


checking if BMP plugin is to be built... yes
checking for bmp >= 0.9.7... configure: WARNING: *** BMP >= 0.9.7rc2 not installed - please install first ***


I don't care, I don't use BMP.


checking curl/curl.h usability... no
checking curl/curl.h presence... no
checking for curl/curl.h... no
configure: error: *** unable to find libcurl headers


Oops, but again, no biggie, I just needed to install libcurl3-dev.

Now it was able to configure correctly.

I compiled it, and installed it.

I restarted xmms, and it showed up as a general plugin.

I signed up for an account on the website, to find some bastard had stolen the username I always use, so I chose something else, and then I entered my details into the plugin.

I enabled the plugin, and played some music, but the website kept saying I hadn't.

I sniffed the network traffic, and saw a lot going back and forth between my machine and post.last.fm.

That looked suspect. I closed XMMS, and ran it from the command line. I saw output from the last.fm plugin.


2006-03-15 13:48:35 [scrobbler.c] sc_parse_sb_res: got new interval: 1
2006-03-15 13:48:35 [scrobbler.c] sc_parse_sb_res: incorrect username/password
2006-03-15 13:48:35 [scrobbler.c] sc_submitentry: Retrying in 1 secs, 0 elements in queue


It was telling me that my username and password were incorrect. I reenetered them, disabled/enabled the plugin, and saw no difference.

I tried changing my password on the website, in case it was too long, because it's 9 characters, but that didn't make any difference.

I tried manually creating the md5sum of my password, and putting it in the XMMS config file, but that didn't work either.

I googled around and found:

http://www.last.fm/forum/4/_/7814/1

but there is no answer there.

I had NFI what the fix was.

I noticed they had their own player on the site, so I downloaded that, and configured it, which worked fine, but it can't play local music, only stream theirs.

I then tried using "Yamipod", but this didn't work either, took 20 minutes to start, would peg my CPU while it did so. When it did start, it has problems, like the playlists pulling up the content of the next one in the list.

Something popped up, and I clicked no on it, and then the whole thing crashed. I tried a few more times to use yamipod but it was a waste of time.

I then tried amarok, and while this worked, and isn't bad, it didn't upload my song details to last.fm either. WTF?

I couldn't find any details about that either, it would just pop up a "tip" and say something like "the last several tracks failed to upload".

I wondered if perhaps the alternate username I'd chosen was too long or something. I created a new account, with a shorted username, and entered the details in amarok.

Hooray, it uploaded some data. I went back to XMMS, and put the new username/password in, and it worked straight away. I changed them back, and it failed again.

So there must be a limit on the username length, while you can have 12 character username, it doesn't work in anything but their player.

(There's a few more posts I need to get around to doing properly here too, since about January).

Update: More bugs. When I got to work, I installed the plugin for winamp, and listened to a couple of songs. I found that yamipod will submit the tracks I listened on my ipod, so I downloaded the windows version.

It runs the same as the linux version, takes ages to start, and the playlists are out of sync. I checked the last.fm status, and saw that it had a cache of the songs I'd listened to on the way to work.

I tried to get it to submit them, but it just didn't seem to. I eventually discovered that it didn't like "localhost" as the proxy address, so I had to put my own ip address in there, and then it would detect the network connection.

It wouldn't submit the list, until I played something, so I did that, and then all my tracks were submitted.

Cool, or so I thought. I went back to listening with winamp, and discovered that my tracks weren't being uploaded, and something about spam protection was being displayed.

When I looked more closely, all the tracks I'd listened to on my ipod had 10 hours added to the play time, so instead of them playing around 9am, on my way to work, last.fm had them listed as being played around 7pm (or 1900).

So now, anything I listen to today, won't get submitted, because it will show as being before I listened to the tracks on my ipod.

As a work around, I've set my ipod back 10 hours, so the times will get "fixed" instead of being 10 hours in the future, and I've set my pc's clock forward 10 hours for today.

Another Update: Something weird going on here. I changed my timezone on the last.fm site, from Australia/Sydney, to GMT+10, and then when I checked the list, the tracks submitted from my ipod had the correct time on them.

What's weirder, is that songs I submitted from my PC, being 10 hours in the future, had been moved back 11 hours, so while my PC's clock was set to 10.47pm, it showed on last.fm as being from 11.47am. WTF?

Ok, I think I know what's going on. last.fm runs in GMT. The Winamp plugin is subtracting 11 hours from the local time, to send the playtime in GMT.

Yamipod did not adjust the times from the ipod, it sent them in the local time.

The TZ setting on last.fm offsets the play times, to change them back to the localtime.

So now, leaving my ipod 11 hours behind, ie GMT, should mean that yamipod will submit the correct (GMT) times, my work pc will adjust local time to GMT, and send those, XMMS sends the times in GMT, and everything will just work.

So yet again, yamipod annoys me. It takes 20 minutes to load, the playlists are out of sync, it won't submit the cached track plays until you play something, and then it sends them in the wrong timezone. Argh.