Scrobbles
Download Scrobbles (Version 1.4.1)
Scrobbles has been downloaded 4,372 times.
What is it?
Scrobbles is a simple WordPress plugin that fetches your Last.fm data and displays it on your site where you wish.
Installation
- First, you need to upload
scrobbles.phpto your WordPress plugins directory. Next, you’ll need to do a quick edit of your template. Find the place where you’d like to display your songs, such as the sidebar, and add the following line:
<?php scrobbles('username'); ?>Replacing
usernamewith your Audioscrobbler username.- Activate the plugin in your WordPress admin panel, and that’s it!
Is that it?
That’s all you need to do, but there are a few things you can do to customise how Scrobbles displays your song info.
scrobbles() can take up to seven parameters that allow you to customise the output further. They are, in order:
username – Required
Your Audioscrobbler username.
num_songs – Optional
The number of songs to display. Defaults to 5 and is limited to a maximum of 10, that being the number of items Audioscrobbler displays in its RDF feeds.
gmt_offset – Optional
How many hours in front of or behind GMT you are. Defaults to
0, GMT, but can be anywhere between -12 and +14.format_string – Optional
How to format the string. By default, it displays the song and date in this format:
%song%<br />Played on %date%%song%,%link%and%date%are the available variables. Dates are formatted according to thedate_formatparameter.date_format – Optional
How to format the
%date%variable. The variables are exactly the same as PHP’s date function.base_element – Optional
The base element of the “loop”. Defaults to
ol, producing an ordered list. Scrobbles assigns this aclassofscrobbles, allowing you to alter visual styling with CSS.each_element – Optional
The element that will be used for each song. Defaults to
li, which makes sense in the context of an ordered list but might not if you changebase_element.
Tips and Tricks
You can make your Scrobbles display a bit prettier and add a “powered by Audioscrobbler” logo if you like. Download this image to your server and add the following code to your theme’s CSS file:
ul.scrobbles, #scrobbles { background:transparent url(path/to/image.png) no-repeat bottom right; padding-bottom:35px; }Changing the path to the image appropriately, and please don’t leech from Last.fm’s servers.
Discuss
You can discuss any problems or post suggestions for future upgrades to Scrobbles – or any of my other plugins – on the mailing list available here. Come join in!
Widget
If you use the WordPress Widgets plugin and a compatible theme, you can use this version of Scrobbles instead:
Download Scrobbles Widget (Version 1.0)
Scrobbles Widget has been downloaded 2,343 times.
Install, activate, and edit the options in the Presentation → Sidebar Widgets menu. Much easier to customise as well as to enable and disable!
Changelog
2005-08-23: Initial Release
2005-08-24: 1.1 – Added date and string formatting, used WordPress’s existing Magpie system, general tidying and improvements.
2005-09-09:
1.2 – Added gmt_offset parameter.
2005-11-01:
1.3 – Added %link% variable.
2005-11-08:
1.4 – Added %artist% and %title% variables – %song% still works, though. Changed to new Audioscrobbler feed URL.