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.
[…] A Last.fm Plugin for WordPress No Comments Sep 06 at 9:51 pm by Rogie fmTuner is a small WordPress plugin for retrieving song details from your Last.fm profile and publishing […]
LikeLike
it would be much cooler if it would be made as a standalone application
LikeLike
@neondragon: Do you mean a standalone php script?
LikeLike
hi. Thanks for plugin
perfect.
Regards
LikeLike
Can you please advice what should I check if fmtuner() function gives zero output?
I have cache xml file downloaded correctly.
LikeLike
@Mad Cat: How is your Display Format set up? Still the default? Also, can you open the cache with a text editor and ensure it’s what you expect? Hope that helps!
LikeLike
Nice, altough it has the same problem as every other Last.fm-Plugin that i know: I have to choose what to display in the settings.
Why not make this an parameter to fmtuner();?
That way i could easily display everything i want using only one plugin.
I have described it in more detail in the comments over there: http://leandrow.net/ilastfm-lastfm-wordpress-plugin/#comments
Any chance you’ll be adding “top tracks”, “top artists”, “top albums” etc and giving us the opportunity to display multiple instances by using it like:
===
My Top Tracks:
fmtuner(‘tracks’);
My Favorite Albums:
fmtuner(‘albums’);
I’m a fan of:
fmtuner(‘artists’);
===
That would easily make your Last.fm-Plugin THE outstanding one out there.
LikeLike
@AgentSmith: That’s a good point! I had assumed it would only be used in one place, but with an added parameter, it could be used multiple times on a site, each with different options.
You can currently choose Top Tracks, but not the other two.
I’ll see what I can cook up :)
LikeLike
I keep getting this error.
Fatal error: Call to undefined function: file_put_contents() in /homepages/42/d161646578/htdocs/home/wp-content/plugins/fmtuner/fmtuner.php on line 237
LikeLike
@Collin: “only tracks with artwork will be shown” is a dangerous option. My case was that no artwork-powered tracks were cached and thus zero output produced.
Still thanks for a great plug.
LikeLike
A FAQ for this might be nice. For example… i got an error message telling me:
Settings Saved – syled nicely… then in plain text underneath >
Call to undefined function: file_put_contents() in /homepages/15/d117163260/htdocs/wordpress/wp-content/plugins/fmtuner/fmtuner.php on line 237
I put the php code in my sidebar include BEFORE any of the if statments for widgets — just to be safe.
LikeLike
@Jake @Joel_: file_put_contents() is a PHP 5 function. Are you by chance running PHP < 5?
The WordPress plugin page linked to above has a small FAQ that is due for some updating now that the plugin is in the wild :) I'll be updating it soon with solutions and problems covered in comments here.
LikeLike
Yeah just realized I have php 4 and have no idea how to upgrade with 1and1.com
LikeLike
After some looking I have php5 but I am still getting the same error, but its on line 236 now.
LikeLike
fmTuner: A Last.fm Plugin for WordPress…
fmTuner is a small 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 upd…
LikeLike
WordPress 2.6.2 Update
I just tested fmTuner with WordPress 2.6.2, and it appears to be working just fine, as seen here at Command-Tab.
LikeLike
@Rogie King: yes, that’s what i meant
LikeLike
Oh… I’m 1and1.com also… but I thought for sure they supported both php 4 and 5!
shoot.
LikeLike
Yo Collin,
Any plan to release this for php4? What is the dependency? Is it the caching or is it the XML libs needed?
LikeLike
I plan on porting it to PHP 4 for a future release, as the dependency on PHP 5 is solely for the XML parsing that comes built-in. It shouldn’t be terribly complicated to find (or write) a basic XML parser for PHP 4 and get things rolling :)
LikeLike
thanks for the info. Everyones responses have been helpful as well.
LikeLike
actually, i did find out how to activate php5 for 1and1 hosting… but it turns out the php init settings do not support that external URL call you make… (even though it might very well handle the xml parsing).
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/15/d117163260/htdocs/wordpress/wp-content/plugins/fmtuner/fmtuner.php on line 248
somehow, I doubt there would be a work-around for this… I’m pretty much stuck with the PHP config my host gives me, right? Any thoughts?
LikeLike
@Joel_: You might be able to drop in an ini_set() call before file_get_contents() is called: ini_set(‘allow_url_fopen’, ‘on’);
Otherwise, you might have to get in touch with 1and1 to see if they can update your config…
LikeLike
it was a great post. i am coming to know about wordpress recently only. great to know that wordpress has these features. will switch one day. thanks.
LikeLike
The plugin does not work for me…
Yes, I am running PHP5. WordPress 2.6.2
Nothing will show up in the template. I get this at the top of my fmTuner settings page:
==================
Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /mnt/local/home/jomilla/jomilla.com/wp-content/plugins/fmtuner/fmtuner.php on line 248
Warning: file_get_contents(http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=jomilla&api_key=ff0eaca3b7e2660755d6c652af7b0489) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /mnt/local/home/jomilla/jomilla.com/wp-content/plugins
=====================
LikeLike
@Jordan: It seems your web host has URL-based file access turned off for some reason. You can try the ini_set solution I gave to Joel (above), and if all else fails, your web host might be able to turn it on.
LikeLike
I’m not sure if I’m that big of a noob, But could you give me some clearer directions? In the meantime I will contact my web-host. Oh, and thanks a ton! :)
LikeLike
And I got this back from my hosting company for the record:
Hello Jordan,
The reason this is disabled is because there is a security issue with URL
based file access specifically url_file_open.
We can’t change the global PHP settings, but you’re more than welcome to
install a custom PHP instance if you’d like:
http://wiki.dreamhost.com/Custom_PHP.ini
I apologize for the inconvenience.
LikeLike
’m not sure if I’m that big of a noob, But could you give me some clearer directions? In the meantime I will contact my web-host. Oh, and thanks a ton!
LikeLike
Got it working! Thanks a lot! Is there any pre made templates for this? or suggestions on building a template??
LikeLike
Hi,
can’t get the plugin running! Cache correctly downloaded, but
no output.
I placed
in my SIDEBAR.PHP. No output. Where do i have to place the
function-phrase and how cant i customize the output?
Sven
LikeLike
I wrote an ASP.NET User Control that provides a similar functionality for any of those out there looking to do this on an ASP.NET page. Hop on over to http://www.dscoduc.com/post/2008/10/09/lastfm-ASPNET-User-Control.aspx for a look and your copy.
LikeLike
Hey any chance on telling us how to style these like yours I want mine to look simelar but I can’t get it quite right. :P great plugin btw exactly what I needed
LikeLike
fmTuner works great with my wordpress…. And I am also using it via OpenSocial on my ning network i have set up for my site!
LikeLike
Thanks for the plugin. I’ll check it out.
LikeLike
I’m not toooo familiar with php stuff. Do I put the code in the sidebar php?
LikeLike
thank you
LikeLike
Thank you . This is really great
LikeLike
Great job. Thanks for the plugin.
LikeLike
I am not familiar with PHP. Any step by step instructions for getting this into the sidebar? It doesn’t seem like it would be too difficult but I have yet to get anything to display. I do know it is installed correctly.
LikeLike
@Scott @Dave: Once fmTuner is installed, activated, and set up (enter your Last.fm username in the fmTuner Settings page), open up /wp-content/themes/default/sidebar.php with a text editor like Notepad or TextMate. Around line 53, add in:
<li><h2>Tunes</h2>
<ul>
<?php if(function_exists('fmtuner')) { fmtuner(); } ?>
</ul>
</li>
Save the file, and reload your blog in a web browser. This will call up fmTuner within your sidebar!
LikeLike
Hey Collin,
have you looked into my comment/request from Sep 08 yet? Any chance you’ll be doing it?
If not, would you mind if I used you plugin as a basis for doing it myself with possibly re-releasing it?
Late happy new year to you! :)
LikeLike
I love your plugin and as one of those “intermediate” designers out on the web, I wrote a tutorial to help those who would like to skin their album artwork to appear as something other than a basic square.
Styling fmTuner plugin to Use Custom Album Artwork
http://www.aunkor.com/?p=12
LikeLike
@AgentSmith: I haven’t yet. If you’re feeling ambitious, go right ahead with your modifications. I’d appreciate a link anywhere on the finished version, but it’s not required :)
@Violet: Cool — great writeup! Thanks for the links, too. I’m glad fmTuner is working out for you.
LikeLike
[…] you are running wordpress (if not, you should be), go download the fmTuner plugin and install it in your plugins directory on your server. Next, activate it. Find the fmTuner […]
LikeLike
Does this work on pages or posts?
If not, know of any Lastfm WordPress plugin that does?
Thanks,
LikeLike
@boogieboa: fmTuner will work on pages, posts, etc. — just about any WordPress-handled template. Since song data is cached, it doesn’t hit Last.fm every time, keeping your site snappy.
LikeLike
What’s the code used to show this as a list within a post? I thought the tags would work within a post but they didn’t.
LikeLike
I’m unable to get the tuner to work on my website… I’m using the code supplied and it doesn’t display anything! please advise
I am using the latest version of wordpress
LikeLike
@boogieboa: The tags won’t work within a post; They only work with fmTuner’s settings. In the fmTuner settings screen, you use the tags among HTML to build the layout for each displayed track.
Then, wherever you insert
if(function_exists('fmtuner')) { fmtuner(); }
(between PHP tags), the list of tracks will get displayed. You can even use this call inside index.php or single.php to display your tracks in every post.@Nate: Any idea which version of PHP you’re using?
LikeLike