This is my latest widget for WordPress. If you use Last.fm to remember the music you listen to, this widget finds the cd covers for the music you listen most often to. I already had a widget that did this, but it used an XML-feed from Last.fm that never updates, so you always saw the same cd covers.
How to show your favorite cds on your wordpress weblog:
- Make sure your version of WordPress is 2.0 or higher
- Make sure your template is widget-ready
- Download Run For Cover version 1.4 here
- Extract the file and ftp it to the wp-content/plugins/widgets folder on your server
- Configure this widget under Presentation » Sidebar Widgets
You can choose where the images link to: Last.fm (default) or Amazon. If you choose to link to the Amazon product page, please note that this includes my associate id for Amazon.
The way it works for those interested:
- it opens an HTML page at last.fm
- filters the source of that page and finds the data for the cds
- browser sends an Ajax request to the server to find the cd cover image from Amazon
- adds the image to the page
- the period from which to use data is configurable now (last week, last 3 months, last 6 months, last year, all)
- check for new version is no longer automatic, version can be checked by clicking on a link in the config
- couple of small bugs fixed
- you can easily check for a new version of this widget
- added ‘Loading…’ text which is configurable, it disappears when first image is loaded
- added ‘No images to display’ along with the necessary checks — this text is also configurable
- widget now starts loading images after page has finished loading
- you can specify in the options if you want to link to Amazon or to Last.fm (Last.fm is default) (version 1.2)
- changed to weekly feed (version 1.1)
Let me know what you think!
Thank you for creating this widget… the previous widget for last.fm wasn’t so great, and I’ve been looking for something that displays recent tracks instead of just my top albums which rarely change.
I tried to implement it on my theme, but it breaks the whole site.. It looks to be something in the end of the display output because it’s trying to put a whole lot of my blog (including the main content section) in smaller boxes on the sidebar.
Here’s some screenshots to give you an example:
With your plugin activated (It’s the “Recent Music” titled widget)
What my site looks like normally
I have even tried disabling the other last.fm widget to no avail.
@Haggis, we already solved this by e-mail — I add this to the comments for other people experiencing this. The widget uses
<div id=”runforcover” />
at line 195 (version 1.2). As some templates use div’s to apply background images to the widgets, you can change the div into
<span id=”runforcover” />
as long as you don’t change the id. This widget will keep using the div for now.
Does it work with group lists?
Hi Subpop, it isn’t in the current version. I checked the pages for groups and I think it could be easily added.
I’ll add it to my list of optional additions.
I seem to have this plugin installed properly but it seems to give me: “No images to display”
Why is this happening?
For people with questions similar to Jase’s: if you subscribed last week to last.fm, you will have to wait for images to appear.
The page on last.fm that I’m using is only changed once a week.
Is there a way to use this as just a plug-in and not a widget? Or is there a non-widget version of this somewhere?
@arison: my code is widget only. I have been working on a last.fm plugin but I guess I wanted to do too much in it, as it got complicated to configure. No plans at this moment to build it into a plugin.
Hi! Great widget!
I wanted to use small images, so I took a look at the code and found line 376:
$_url = stringBetween($_amazon_xml, ‘<MediumImage>’, ‘</MediumImage>’);
and changed it to
$_url = stringBetween($_amazon_xml, ‘<SmallImage>’, ‘</SmallImage>’);
this way, you get 75*75 images from Amazon instead of 160*160, which is a good idea if you’re not going to display larger images.
Just in case anyone was wondering
@felipe: yes, this is on my list of things to add to the configuration. The configuration form is getting bigger and bigger 😉