fmTuner: A Last.fm Plugin for WordPress

fmTuner is a WordPress plugin for retrieving song details from your Last.fm profile and publishing them anywhere in your WordPress theme. It provides options for choosing among your Recent, Loved, or Top tracks, as well as tools to adjust the update frequency and appearance.

Of particular note is the customizable Display Format option. Using simple tags like [::artist::] and [::image::] intermixed with regular HTML, you can tweak your Last.fm tracks exactly how you like, or however your WordPress theme requires. You have full control!

Download

Download the latest fmTuner from WordPress.org

Requirements

  • WordPress 2.7 or newer.
  • PHP 5 or newer
  • Basic knowledge of PHP, HTML, and WordPress.

Installation

  • Upload fmtuner.php to a directory inside /wp-content/plugins/ directory. For example: /wp-content/plugins/fmtuner/fmtuner.php
  • Ensure /wp-content/plugins/fmtuner/ is writable by your webserver.
  • Activate the plugin through the “Plugins” menu in WordPress.
  • Set up options in the “Settings” menu in WordPress.
  • Place the PHP code if(function_exists('fmtuner')) { fmtuner(); } in your templates, to call up fmTuner.

Release History

  • fmTuner 1.1
    Released on Feb. 1, 2010
    Added a placeholder image field to the fmTuner Settings page, which will be substituted when tracks have no artwork.
    Tested under WordPress 2.9.1.
  • fmTuner 1.0.8
    Released on Nov. 3, 2009
    Fixed a bug with the [::url::] fmTuner tag that caused Last.fm links to appear incorrectly.
  • fmTuner 1.0.7
    Released on Apr. 23, 2009
    Tracks with foreign character sets now display more accurately.
  • fmTuner 1.0.6
    Released on Mar. 29, 2009
    You can now display more than 10 Recent Tracks, and you should get fewer tracks without artwork.
  • fmTuner 1.0.5
    Released on Mar. 22, 2009
    Track information is now properly escaped to handle $ signs, quotes, and other non-alphanumeric characters.
  • fmTuner 1.0.4
    Released on Dec. 14, 2008
    Made minor tweaks for fmTuner Settings page under WordPress 2.7.
  • fmTuner 1.0.3
    Released on Nov. 15, 2008
    By request, a [::number::] fmTuner tag has been added, which emits a sequential number for each track (starting at 1). This is particularly useful for CSS and JavaScript display purposes.
  • fmTuner 1.0.2
    Released on Oct. 5, 2008
    Added a cURL-based alternative to file_get_contents to hopefully resolve “URL file-access is disabled” issues. If allow_url_fopen is disabled in the php.ini, cURL will be used to fetch the Last.fm feed instead.
  • fmTuner 1.0.1
    Released on Sept. 9, 2008
    Added better failure checking and informational messages, removed development code, and updated instructions.
  • fmTuner 1.0
    Released on Sept. 6, 2008
    Initial release.
Advertisements
fmTuner: A Last.fm Plugin for WordPress

93 thoughts on “fmTuner: A Last.fm Plugin for WordPress

  1. Erik says:

    I’ve noticed that alot of the songs that i listen to won’t show. I’m not sure why they don’t show though, since the song and artwork gets scrobbled by my last.fm-app. And since the app recognize the artwork, shouldn’t the plugin show it as well?

    Like

  2. @Erik: Not necessarily. fmTuner only shows tracks with artwork supplied by Last.fm, which may not be every song you listen to. Your player is likely showing artwork embedded in the music file, whereas Last.fm has its own set of images. If you’re using the [::image::] tag and Last.fm has no artwork for that particular track, it won’t be shown. Basically, fmTuner errs on the side of “making your site look good” versus “show every single song”.

    Like

  3. I tried installing your plugin on my WordPress 2.7 installation. Unfortunately I get zero output, as MadCat already described. My XML file is being correctly updated every 15 minutes and the content looks correct for me. Here a snippet from my XML file:

    Eisbrecher
    Herzdieb

    But nevertheless no output in my sidebar (that’s why it’s not active at the moment). What else could be the cause? I tried using your defaults and copied the code to several locations in my theme.

    Like

  4. Hey,
    I am having the same problem as Ulf using WordPress 2.7.1. I do have to admit I am deficient for web-coding but it seems simple enough to add this to sidebar.php as part of a list. I am using
    Tunes

    mayble the ul is supposed to go before the li? Any help would be greatly appreciated.

    Like

  5. I’m still attmpting to replicate the no-output issues. One possibility is that you’ve listened to a bunch of tracks with no images and you are using the [::image::] tags, thus there are no tracks with “worthy” data. I could potentially add a placeholder message or HTML for when this occurs.

    @Ryan: The best way to shrink the images would probably be to inster them inside an IMG tag with a defined size, say width=”32″ height=”32″. Then, the user’s browser will scale them as instructed.

    Like

  6. Ulf, I am not sure this is correct in any way as far as coding style goes…..but, I have to place this outside of the “if” for the dynamic side bar in sidebar.php.

    <?php endif; // end primary sidebar widgets ?>

    </ul>
    <hr size=1>
    <h3>What I am Listening To</h3>
    <em>via <a href=”http://www.last.fm/listen/user/rfrankel/personal” target=”_blank”>My Radio Station</a></em>
    <?php if(function_exists(‘fmtuner’)) { fmtuner(); } ?>

    </div><!– #primary .aside –>

    Hopefully, this shows up.

    Like

  7. Hi, Love the plugin. Quick note, track name seems to break if it includes (or starts with, in my case) a ‘$’ symbol.

    Other than that, loving it :)

    Like

  8. hi,

    I installed the pluggin, it displays on homepage but I cannot select or get music. The only thing you see is the image of the artists album
    Can anyone help me?
    irene

    Like

  9. Love the plugin and will be using it on my new theme i’m working on for my personal blog. But i seem to have stumbled on a little problem as i’m trying to display the last 20 recent tracks but it seems to only return 10.

    Its fine on Loved and Top Tracks but Recent just returns 10. If you want any debug info please just drop me a mail.

    Like

    1. @Phunky: Last I checked, Recent Tracks from Last.fm only returns 10. Do you know of any tools that return more than 10? If so, I could figure out how they get more than 10 and do the same.

      Like

  10. @Phunky: I did some more research, and found out that Recent Tracks can in fact show more than 10; you just have to ask Last.fm for more. I’ve updated fmTuner to 1.0.6 to do just that. This should take care of it!

    Like

  11. This is a very nice plug in, great work! Unfortunately, you need some basic HTML / CSS skills to make it work properly. Is there a way that you can make a basic widget based template?

    Like

  12. @N1kname: I’m working on widget support for an upcoming release. However, I’ve never actually used WordPress widgets before, so it’s entirely new territory for me :-)

    Like

  13. Hey Collin,

    I’ve been having this issue where fmTuner will randomly decide to display some random number of tracks less than what I have it set for (6). I just looked at my site to find it displaying 1 track… previously it happened and displayed 3 tracks. Any ideas?

    Like

    1. @Brian: I’ve seen this happen when using the [::image::] tag, as fmTuner runs out of tracks supplied with album art before reaching the limit. I’ve increased the “buffer” range that gets pulled from Last.fm in the 1.0.6 release, but it wouldn’t be hard to do this by listening to songs in sequential mode (e.g. you listen to a few songs with artwork, then start a new album which has track info but no artwork, pushing the ones with artwork further and further “out of view”). I tried to work this into the design a little bit, by calling that number a “limit” instead of a hard “show me X number of tracks”.

      The alternatives are:
      – Fetch even more tracks in the hope of hitting ones with artwork, or…
      – Employ a placeholder album art image as opposed to skipping the track entirely

      Like

  14. Thanks Collin. I thought of doing the blank artwork deal but was initially against it. That’s actually the route I’ve gone for now. You said “fetch even more tracks” which I knew to do, but it was kind of causing me to panic because my tracks were displaying in an area of my site layout that’s not flexible. Still haven’t made a final decision, but for those folks who are having the same dilemma, Collin is right, you need to fetch more tracks. The catch is if you don’t want the number of tracks displayed to be random, fetch a high number, define height/width for each in css, and then set the containing to “overflow: hidden”. So there’s my solution, though now I don’t know if I want to get rid of blank artwork or not.

    Like

  15. hey there,
    i’m having the dreaded ‘failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden’ issue.

    i’ve tested for curl, got this;

    array(9) {
    [“version_number”]=>
    int(463620)
    [“age”]=>
    int(3)
    [“features”]=>
    int(1565)
    [“ssl_version_number”]=>
    int(0)
    [“version”]=>
    string(6) “7.19.4”
    [“host”]=>
    string(17) “i686-pc-linux-gnu”
    [“ssl_version”]=>
    string(14) “OpenSSL/0.9.8b”
    [“libz_version”]=>
    string(5) “1.2.3”
    [“protocols”]=>
    array(8) {
    [0]=>
    string(4) “tftp”
    [1]=>
    string(3) “ftp”
    [2]=>
    string(6) “telnet”
    [3]=>
    string(4) “dict”
    [4]=>
    string(4) “http”
    [5]=>
    string(4) “file”
    [6]=>
    string(5) “https”
    [7]=>
    string(4) “ftps”
    }
    }

    so, sent my webhost an email re;

    allow_url_fopen`=”On”

    and got this;

    Hi,
    The only access you have to turn on server based applications like that would be the .htaccess file in the public_html folder.

    am i even ‘able’ to run that command(?) in something like an .htaccess file???

    i’d REALLY like to get this up and running, so any help you can give would be very much appreciated.
    thanks in advance….
    Jas

    Like

  16. Well…I have it installed & would like to use the overlays from komodomedia.com but I absolutely cannot figure out how to make it work. Nor can I figure out how to make a nice looking display. The alt tag is not working to display the name of the song that I’ve listened to for me, either.

    http://www.sogroovynow.com/music/

    I placed it here so I could work on tweaking it & seeing if I could figure out the album overlays but as you can see…not much happening.

    Like

  17. […] fmTuner Next up we have fmTuner, which retrieves song inform­a­tion from your Last.fm pro­file and pub­lishes them to your Word­Press theme. In much the same way as FlickrRSS, you only have to enter your user­name and options to dis­play. For those won­der­ing, the dis­play format I’m using to show the tracks to the very right of this post is <li class="lastfm-item"><a href="[::url::]">[::artist::] – [::title::]</a></li> […]

    Like

  18. Ok,

    I’ve downloaded the plugin and I have a Last fm account, but I’m finally ready to admit that I’m in way over my head. Can some one walk me through “what” I put “where” and in what order. I can’t actually figure out how to make the player show up anywhere on my page. Just assume I don’t have any idea what I’m doing. Because I don’t. Thanks – I’m getting desperate.

    Like

  19. Hi–great plugin–I love the ease of use and customability, though I don’t understand why there’s the limitation of displaying track info only for songs that have last.fm artwork. I’ll play around with this to see if I can work around that so that every track is displayed (I don’t use the images since the ones last.fm chooses to display are usually not the right ones).

    Also–is there any way to have the plugin auto-update without the page having to be refreshed?

    Thanks again for your work!

    Like

  20. @Chris: fmTuner will display all tracks if you’re not using the [::image::] tag. Only when you’re using it does it skip the ones without artwork. It assumes that if you’re using the [::image::] tag, you intend to show off artwork, so it leaves out ones that don’t have something worth showing. Otherwise, it will display everything, uncut.

    Like

  21. Verry nice plugin!
    I would love to be able to click on the poictures and get to the page on last fm, so people dont have to copy and pste names.

    But as for that its nice work, thanks for sharing!

    Droid Boy

    Like

  22. Michael says:

    Loving this plugin!

    My query was about styling it as I notice on your homepage you’re able to keep each album in it’s own li class? How do you do this to align the albums vertically rather than horizontally?

    Thanks! (And apologies if I’m just not being very clever!)

    Like

  23. I had 9 albums with no art work in a row. is there no way to load a default album image if no album image is available? this plugin is a pretty big part of the design of the footer on our site. so it looked like our site was broken when the 9 albums had no covers.

    Like

  24. Joey says:

    Hey, great plugin! Very fun and easy to style with some nice CSS.

    I am however experiencing a little problem.. It works fine and everything, but as of now it refuses to show my recent tracks and only 1 of my loved ones, while i have plenty.
    I cleared my cache multiple times and even viewed it on another computer. It does show a couple of recent tracks, thought yesterday this was 5 and today it is 2. Very odd.

    All my settings still seem to be set correctly. With 8 showing max. Checked my username like 10 times, and its supposed to update every 30 minutes.

    Any idea what might be wrong?
    Joey

    PS: I’m sorry if this is not the correct place to post this.

    Like

  25. Thanks a lot! I am just learning Information.
    And php and this was very easy to follow and helped a lot.
    You really took time to explain every little bit.
    Thanks again…

    Like

  26. Cool plugin.
    Would it possible to get exactly this effect but without having to use wordpress?
    I’m looking at just handcoding a small one page site and using thumblr for the blog on a sub-domain, so don’t want to have to use wordpress.
    Thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s