Last.fm scrobbling – fixing album tag submission on Logitech Media Server

This bug has been annoying me for quite some time. On the last few versions of Logitech Media Server (LMS) for Squeezebox devices, the standard Last.fm scrobbler plugin has been faulty. The scrobbling basically works, but the album title is not submitted correctly. This results in Last.fm not being able to assign your scrobbled track properly to an album. It would show some random album cover (if the track was released on multiple cds) in your recently played tracks, but not allocate the track to its proper album in your music library.

I have tried the SqueezeScrobbler Plugin, and it works fine on locally stored music files, but not on streaming services like Deezer.

A bug description on Launchpad pointed to a possible cause: The musicbrainz id tag from my music files. Since I use Musicbrainz, this seemed an interesting lead. So I played with the plugin file from LMS and guess what, it worked. You just have to disable the submission of the musicbrainz id to Last.fm.

In my case, on my Ubuntu installation, the relevant plugin file is located at /usr/share/perl5/Slim/Plugin/AudioScrobbler and is called Plugin.pm. So simply edit this file and search for this bit of code (line 592 is the relevant one):

my $post = 's=' . $client->master->pluginData('session_id')
        . '&a=' . uri_escape_utf8( $meta->{artist} )
        . '&t=' . uri_escape_utf8( $meta->{title} )
        . '&b=' . uri_escape_utf8( $meta->{album} )
        . '&l=' . ( $meta->{duration} ? int( $meta->{duration} ) : '' )
        . '&n=' . $meta->{tracknum}
        . '&m=' . ( $track->musicbrainz_id || '' );

Change the last line of the code above. I commented the original line out and replaced it by empty content:

#	. '&m=' . ( $track->musicbrainz_id || '' );
        . '&m=' . ( );

Then restart the LMS service:

sudo service logitechmediaserver restart

That“s it.

tl;dr: If you use Musicbrainz to tag your music files, Logitech Media Server to play them, and the album allocation on Last.fm appears weird or nonexisting, apply the patch mentioned above.