Last.fm Recent Album Artwork Plugin(edit)

My blog is now running a WordPress plugin that shows the album covers from Last.fm of songs I've recently listened to. There's a lot of plugins out there, but none that I found that did the job of getting the artwork, and certainly not for the most recent albums.

Download the Last.fm recent album artwork plugin

Last.fm Integration

You'll need a Last.fm account and the iScrobbler running to store the recent tracks at Last.fm. To check, you can view the recent tracks feed changing remysharp to your Last.fm username.

Installing

Download the Last.fm recent album artwork plugin and save it in your plugins directory (usually located in wp-content).

Then activate the plugin from the Plugins tab in your WordPress admin tools.

Setup

Through the Options -> Last.fm Recent Albums tab fill out the required fields.

Album Art Cache Settings

You must ensure the directory that you point the plugin to is writable. You can use either full or relative paths for the album artwork.

For example, my album artwork is located at http://remysharp.com/albums/, so my URL is set to:

/albums/

Within my WordPress set up, this is physically located in /home/remy/remysharp.com/htdocs/albums/, but I've set the path to be relative in the settings, so it reads:

albums/

Since the root of my WordPress installation is /home/remy/remysharp.com/htdocs/ this works just fine.

Adding to your Blog

Once the setup is complete, use the get_lastFM_album_artwork() function to add the album artwork to you blog. My blog adds the code as follows (with the setup wrapping the elements with li)

<?php if (function_exists('get_lastFM_album_artwork')) { ?>
<div class="lastfm">
<h3>Recent Albums</h3>
    <ul>
    <?php
        get_lastFM_album_artwork();
    ?>
    </ul>
</div>
<?php } ?>

Behind the Scenes

Behind the scenes the code will only show album artwork if Last.fm have the album associated (there's a number of tracks that don't have that information linked). If there's not enough recent tracks from the feed, the plugin will fill the rest of the albums based on the recently played albums (using timestamps from the artwork files).

The plugin will also avoid showing the same album cover twice.

Problems?

If you have any problems or suggestions or questions about the plugin, please let me know and I'll do my best to help.

Comments

comments powered by Disqus