Posts Tagged ‘audioscrobbler’

ruby-mp3info utf-8 support

Wednesday, February 6th, 2008

While apparently there are plans to improve ruby’s support for unicode, the 1.8 stdlib doesn’t make working with encodings transparent. The historically poor support has had its toll on ruby libraries, as I discovered while updating scroball.rb to do the right thing with utf-8.

It led to this patch. On the whole though, it’s of limited use. You don’t see the Id3v2 class from the Mp3Info class, so you don’t get an opportunity to set the encoding up. Even if you did, the implicit assumption that the user deals solely in iso-8559-1 isn’t comforting. Fortunately the characterspace isn’t always truncated into iso-8559-1: strings which fail the iconv transcoding get left alone.

The situation with ruby-mp3info is symptomatic of several legacies: id3v2 and its ad hoc unicode extensions, and second-class support of unicode strings in ruby before 1.9.

scroball.rb: an audioscrobbler client

Friday, December 21st, 2007

After discovering the awesomeness that is last.fm I became annoyed at it indexing the misrepresentative contents of my local iTunes library. This gave the false impression that I spend most of my time listening to Kanye West’s Gold Digger (catchy though it is).

I play most of my music using iTunes Shared Libraries and an mt-daapd server running on scant. If there’s a way to make last.fm scrobble music iTunes accesses from a DAAP server, I couldn’t find it. Then there’s all the music I listen to with players that lack audioscrobbler plugins. Why wait for last.fm to work out what my tastes are? I needed a way to let audioscrobbler catch up with me: manual scrobbling.

Fortunately audioscrobbler provides documentation of the Audioscrobbler Realtime Submission Protocol. From this, I hacked together a ruby script to scrobble my music directories: scroball.rb. It does do a little bit of subterfuge: it backdates and calculates the start times to avoid collisions that audioscrobbler would pick up in sanity checking. This can legitimately be used to retroactively scrobble a listening session.

ruby ~/scroball.rb p00ya `/bin/date -d 'last wednesday' +%s` .

yay! Hopefully the last.fm folks like it; it’s not intended for abuse.