Last.fm has announced some new widgets that you can place in your web site. I decided to create a PmWiki recipe for how to embed them there. For an example, notice that my sidebar now has an album quilt. Without further ado:

This recipe allows you to incorporate Last.fm widgets into your PmWiki installation.

To install, place lastfm.php in your cookbook directory, then add the following to config.php or another local configuration file:

  include_once("$FarmD/cookbook/lastfm.php");

You can embed radio players, playlist players, quilts, or charts.

For more information, see http://last.fm/widgets.

The recipe enables the (:lastfm:) markup. You add arguments to customize the widget.

Here are the arguments:

  type (chart, radio, playlist, quilt)
  user 
  color/colour (red, blue, black, grey)
  chart (recent, topartists, toptracks, weeklyartists, weeklytracks)
  quilt (album, artist)
  orient (horizontal, vertical)
  size (small, medium, large for quilts; regular, mini for radios)
  autostart ( 1 for an autostarting radio )

If you just put in a username and nothing else, you will get, by default, a red medium-sized chart of recent tracks played.

Tags >>

Posted in ,



9 comments on "Last.fm Widgets for PmWiki"


errorsys
October 12th, 2007 at 9:01 am

I get some errors with IE7. Did you test it with this browser?

Jon
October 12th, 2007 at 8:45 pm

I think so. What kind of errors are you getting? I'll have to try it again, I guess.

errorsys
October 13th, 2007 at 11:21 am

I checked that the first error was caused by template from skin "not2simple" that I'm using. The other one is from lastfm.php: Syntax error, code 0. When I remove the following line: onclick="window.open(this.href + &squo;&shrink=0&squo;, &squo;lastfm_popup&squo;, &squo;height='.$popupheight.', width='.$width.', location=no, toolbar=no, menubar=no, directories=no, personalbar=no, status=no, resizable=yes, scrollbars=no&squo;); return false;" style="background-image:url(http://panther1.last.fm/widgets/images/footer/'.$args['color'].'.gif);"></a>'; all is ok. Additionally I found that Last.fm have changed their widget a little - do you know about it?

Jon
October 13th, 2007 at 10:13 pm

I hadn't noticed that they'd updated the widgets. I'll see if I can work up a new version that's consistent with whatever changes they've made and maybe that'll take care of the problem.

errorsys
October 15th, 2007 at 5:36 am

IE doesn't like &squo; I think that you should replace it with '

errorsys
October 15th, 2007 at 5:38 am

I mean by ascii code: & # 3 9 ;

Jon
October 15th, 2007 at 11:44 am

I see--thanks. I don't use IE, so I suppose I wouldn't know about such things. I'll see if I can fix it sometime soon.

Matt
August 30th, 2008 at 5:04 pm

This is an interesting cookbook recipe. Unless I"m missing something, however, it seems to miss out on one of lastfm's most remarkable features, which is the ability to create radio streams with music "like" such and such an artist (e.g., like Josquin des Prez). I'm a teacher with an educational wiki and I would love to be able to embed such themed radio in my course wiki. E.g., for a page on the blues, have a stream music "like Charley Patton." I certainly DON'T want my students listening to my own eclectic last fm "user" music. Any suggestions?

Jon (http://jonhaupt.net/)
September 9th, 2008 at 11:09 pm

Yep, that's kind of a problem. I think those sorts of things require you to be a Last.fm subscriber (am I remembering that correctly?) and thus putting it in widget form is sort of problematic. If they ever do produce a widget though, it would be pretty cool to put it in a recipe like this.


Add a comment

Name:
E-mail: (for gravatar only, not stored.)
Website: (e.g. google.com)
Type your comment
Type this number: 332