Naamloos

Update: this widget uses an XML-feed from Last.fm that doesn’t update regularly. I have written a new widget: Run for cover. It uses a page at Last.fm that updates every week. More information here.

Turned my bit of PHP for displaying cd covers into a widget for WordPress. It reads the top-albums feed for a last.fm username and displays the covers for the cds.

  1. Download version 1.3 Go here for my new last.fm covers widget.
  2. Extract, drop lastfmcovers.php in /wp-content/plugins/widgets and configure it under the “sidebar widgets” tab in WordPress.

Settings include:

  • title: displayed at the top of the widget
  • username: last.fm username to display cd covers for (no password needed)
  • max displayed: number of images to display
  • description for count: text used in alt/title-tag of the images, % will be replaced with ‘count’
  • image size: pixels for image width and height. Set this to zero to use img.lastfmimage in your stylesheet

What it needs:

  • check if username exists
  • sample stylesheet code
  • suggestions

Update: last.fm changed their “no_album” image, so if you see little grey circles in your sidebar, please install the current version — version 1.3 is now really 1.3.00001.

38 reacties

  1. dog of Dirk,

    I am experiencing a problem using WordPress 2.02 and the Last.fm Covers plugin. I hope you can help me see my mistake. I took screenshots of what I did.

    1. I placed the lastfmcovers.php in /wp-content/plugins/widgets:

    http://joe.strangeisle.com/screenshots/01.placement.gif

    2. I have the Widget plugin and I have activated both the Widgit and the Last.fm Covers plugin:

    http://joe.strangeisle.com/screenshots/02.plugins.gif

    3. The widget appears in my widget list screen and I have entered the data for my Last.fm user name:

    http://joe.strangeisle.com/screenshots/03.widgetscreen.gif

    I have selected “0” for Image Size and I am using the following line in my CSS:

    img.lastfmimage {padding: 1px; border: 1px solid #333333; margin: 3px; width: 50px; }

    4. My topalbums.xml file works on the Last.fm website:

    http://joe.strangeisle.com/screenshots/04.lastfmpage.gif

    5. But the widget is still not visible on the sidebar of my website:

    http://joe.strangeisle.com/screenshots/05.website.gif

    Am I making a basic error I cannot see? Thank you for your consideration.

  2. Hi ! Thx for your work

    I’m getting the following error :

    Warning: Invalid argument supplied for foreach() in /home/victoire/www/wp-content/plugins/widgets/lastfmcovers.php on line 46

    any idea ?

  3. Hey guys. I got this installed okay, it seems. I placed the widget into the sidebar and adjusted the username. It still just says “No cd covers to display” I KNOW there there are. I went to my list of most recently played songs, clicked on the most recent ones only to find that they DO have album covers attached.

    Here are my settings:
    Title: Last.fm
    Username: slant675
    Max displayed: 6
    Description for count: % times.
    Image size: 70

    For the most part, I thought this was default. The error blantently alludes to the fact that it is working logic-wise at least. The problem is that where the widget is looking, last.fm is not telling it that album covers exist for what I’ve been listening to.

    Thoughts? Thanks!!!

  4. Furthermore, my AudioScrobbler page (http://ws.audioscrobbler.com/1.0/user/slant675/topalbums.xml) does not seem to have anything in it. How bizaar. Is this normal? I’ve used the AudioScrobbler plugin to gather a few songs, but I have mostly been using http://pandorafm.real-ity.com/ (starting today – heh).

    This seems to skip the AudioScrobbler plugin altogether, though I’m not certain. Does this change anything?

    Awesome-looking plugin!! I can’t wait to get it working, I have 6 other blogs hosted on my site also, so they can’t use it either. 🙁

    Thanks so much!!

  5. Anybody know how to contain the box that holds all the albums? I have the covers displaying just fine, but they extend outside of my sidebar, and it creates a rather ugly overlap. See it here: http://www.superbrian.org. See what I mean?

    Sorry if this is a very basic question. I’m rather new at this. Thanks.

    -Brian

  6. Your widget looks really cool, but I can’t seem to get it to work on my site. When I set all the options, my username doesn’t seem to persist as a setting. Every other setting remains, but when I go back in to check the settings, the username field has been blanked out. I tried checking the feed URL you gave to Ryan above, but replaced slant675 with my username, nixoncd, and my feed was there. Any suggestions?

  7. Hi supagold — I tried setting your username on my own weblog and this works ok, as expected. You could mail me the other settings for the widget, presuming you changed them, so I can try to find out what happens.

    This widget uses the standard WordPress system for settings, so it’s hard to say what’s happening here.

  8. Hi IronMAN,

    I have been looking at your site and my widget but can’t find anything wrong with it. It could be a simple rights question — the php opens a socket to get the feed. If you’re not allowed to do that on your server, it can’t read the feed.

    Also have you double checked that wordpress has saved the settings?

    I also set my own widget to your username and that showed the covers ok.

    Good luck!

  9. Any chance you want to create a Dreamhost-friendly (that is, with an fopen workaround) version of your plugin? I use Dreamhost, and LOVE your plugin, but can’t get it to work.

  10. I’ve added some functionality to your Last.fm covers widget. It now has a new feature, configurable through the usual front end, which allows users to optionally enclose the cover images in a div element, styled to be margin and border less and with the alignment of their choice. This allows the cover images to be centered, right and left aligned in a sidebar, and other graphical treatments, while keeping the title still formatted according to $before_title and $after_title variables.

    This could also be achieved by adding bits to $after_title and $after_widget, but this would also alter all widget content from other widgets. In my specific case I wanted my blogroll list left aligned, my covers center aligned, but both headings left aligned.

    This is my first go at PHP coding, so expect a bug or two… I’d like to send you the additions for consideration for inclusion in the next version, but I can’t find your email address.

  11. Pingback: English
  12. I think something might have just changed on the last.fm side of things. It seems that they had a few updates in the last few hours and for the first time today I get this message instead of the covers in my sidebar:
    “No cd covers to display”

    Coincidence? Maybe, maybe not. You tell us.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd.