Last.fm RPS Wordpress Plugin
May 4th, 2008 | By Taha Paksu
Description : Its a widget plugin which collects data from Audioscrobbler web services and gets your last listened tracks and their album images. It works in PHP4 platforms and uses my simplexml class to collect data from Audioscrobbler.
Installation : The directory structure should be like this :
--> wp-plugins/ |-- lastfm_RPS/ |-- noart.gif |-- simplexml.class.php |-- readme.txt |-- lastfm.css
Then just activate the plugin, go to Design-Widgets, add the widget where you want, write the username and widget title in the settings and save. That’s all.
Note : If your theme isn’t widget enabled, you can insert this plugin in your sidebar.php file or wherever you want like this :
Download : You can get the latest release here : http://wordpress.org/extend/plugins/lastfm-rps/
Demo : You can see a working example in my homepage.
Whats New in Version 0.2?
- Added option to define how many songs are displayed on the page
- Seperated css file from code and added new “lastfm.css” file
- Added different stylesheets to recently played songs
- Changed the datetime display configuration like “x days y seconds and z minutes ago”
- Changed the div’s into tables which are more reliable for different themes.
- If the user hasn’t any wp_head() included in his/her theme’s header.php, this script checks and adds its css itself.
Whats the fixes in Version 0.3?
- Added a neccessary fix for the time difference between server time and local time.
- If there is a track played in the player which length is less than 4 minutes ,the script showed two recently listened songs, so this is fixed now.It only displays one.
Whats new in Version 0.4?
- Added support for not widget-ready themes.
- Added Screenshot
- Updated Readme.txt
Whats the fixes in Version 0.5?
- When no songs played for a long time or only played only one song, this script raised errors. This is fixed now.
- Optimized the SimpleXML Extension for speed issues.
What’s added in v0.6?
- Improved checking of album images.
- If the feed item contains no album name, then directly shows default image.
What’s New in v0.7?
- Added image positioning
- Added optional Bottom Text
- Removed the slashes before ‘ and “
- Converted tables to css so you have all the control in lastfm.css
- Added artist images support. Now it shows artist images when it can’t find the album image.
People who looked at this item also looked at…
Related items


















@Bart:
Hey!
I fixed this problem on my site:
Search this line:
$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
Under this, add a a new line:
if($fullDays == -1) return “now playing”;
Its works fine.
Yea, having this problem as well, but the solution you stated isn’t working for me.
I get this error:
“Parse error: syntax error, unexpected T_STRING in /home/soratokujira/soratokujira.tk/wp-content/plugins/lastfm-rps/lastfm.php on line 191″
Any help?
sorry i don’t know how but it went to my spam folder that i just realised
thanks for that fix.
My songlist isn’t showing up correctly – it’s all jumbled up. Can anyone help?? I’m using WP 2.9.
http://countingtheyears.com
Thanks x
I can’t get the plugin to pull my song info. Do I have to scrobble from a local player or does it pull info from the online listening of last.fm. Want to make sure I cover my bases. Plugin looks great though.
Thanks in advance.
what exists in your personal profile page as listened or listening is displayed in this plugin. the answer is both you are listening locally and submitted to last.fm and you listen on the last.fm radio should be displayed here. and if you didnt listen to a song for a while maybe it wont show any songs on your profile.
Hello! I love your plugin, but have made one adjustment that you might like to add to the main version. In lastfm.php, I have adjusted my lastfm_datediff function to account for songs that are currently being listened to. These songs will have a $dateDiff of zero or less. My modified function looks like this:
function lastfm_datediff($date,$ret = 0,$serversec,$recentdisplayed){
$now = time();
$dateDiff = $now – $date + $serversec;
$fullDays = floor($dateDiff/(60*60*24));
$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
if($dateDiff =4) return “$fullMinutes minutes ago”;
if($recentdisplayed) return “$fullMinutes minutes ago”;
if($ret) return “recent”;
return “just listened”;
}
where I’ve added the line: if($dateDiff <= 0) return "listening now";
Heh, I guess the code doesn’t show up too well in the comments. Anyway.. add
if($dateDiff <= 0) return "listening now";
right after the line:
$dateDiff = $now – $date + $serversec;
Thank you. I’m gonna review all the comments since the last version and build a new version but i don’t know when i’ll have a chance to do that. But thanks.
Really great plugin ! very good looking, Thank you …
So, i have a problem with the times sometimes when i listen to tracks, is see this -1d,23h and 58m ago for example offcourse.
What the problem? Can it be fixed? I really want it to work properly!
hi,
thats because the last.fm server’s time is different from your hosting server’s time. There’s a box in the plugin’s configuration labeled “server time difference” so you can set the difference there, for example the song you are listening is displaying like this :”-1d 23h 55m ago” this means your server’s time is about 5 minutes = 300 seconds different from last.fm server’s time. you should set the value 300 or maybe 330 there and try again.
Hey mate I finally uploaded my blog onlone and it still doesnt work still says This username does not exist, or the feed service is down Just thought to let you know
that’s because this plugin fetches a xml file from last.fm.. try it again when you upload your site on a host.
Tried it again and i observed the following:
The page takes blog page takes an incredible amount of time to load even though its on localhost and when it loads i get this “This username does not exist, or the feed service is down.”
however if i disable the plugin. the page loads faster like it should.
my username on lastfm is bigbrova and phpinfo showed that XML is enabled and active. How there the widget work, will it for example work if am behind an http proxy? my localhost is behind an http_proxy so i had to add the proxy parameters to wordpress config which works fine for other internet aware widgets
does your username contain uppercase characters? What’s your username? I’ll try myself. On the other hand, you may not have the PHP’s XML extension installed on your localhost. That might be the problem too. Check it with phpinfo() function. Is there a “XML” component installed on the list?
“This username does not exist, or the feed service is down. ” that is what i get when i install it. am trying to run it on my localhost (ubuntu 9.04) what gives?