Run for cover

Download widget

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
  • writes the data to the javascript file
  • browser sends an Ajax request to the server to find the cd cover image from Amazon
  • adds the image to the page

version 1.4

  • 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

version 1.3

  • 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
  • single quote in artist/album names is replaced with ` to avoid javascript errors
  • widget now starts loading images after page has finished loading

Earlier versions:

  • 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!

14 reacties

Haggis 16 november 2006 Reageer

Hello there!

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.

hondjevandirkie 16 november 2006 Reageer

@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.

subpop 27 november 2006 Reageer

Does it work with group lists?

hondjevandirkie 27 november 2006 Reageer

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.

Jase 30 november 2006 Reageer

I seem to have this plugin installed properly but it seems to give me: “No images to display”

Why is this happening?

hondjevandirkie 6 december 2006 Reageer

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.

arison 11 december 2006 Reageer

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?

hondjevandirkie 11 december 2006 Reageer

@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.

felipe.lavin 11 december 2006 Reageer

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

hondjevandirkie 12 december 2006 Reageer

@felipe: yes, this is on my list of things to add to the configuration. The configuration form is getting bigger and bigger 😉

Geef een reactie