Last.fm RPS WordPress Plugin

 

 

 

 

 

 

 

 

 

 

 

Note: if you have this error message shown inside the plugin :

Deprecated: Function split() is deprecated in
blabla/wp-content/plugins/lastfm-rps/lastfm.php
on line 120

Please change

$artist = split("_",$string);

on line 120 to

$artist = explode("_",$string);

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 :

<div>
<h3>My Last.fm</h3>

<?php lastfm_recent_sidebar([username],[songs to show],[timezone diff in seconds],[image position 'left' or 'right'],[The text at bottom of this widget],[enable cache 'true' or 'false'])?>

</div>

Download : You can get the latest release here : http://wordpress.org/extend/plugins/lastfm-rps/

Current Version : 1.1

Demo : You can see a working example in the middle sidebar at 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.

The changes in 0.8

  • Added Various Artists album image support
  • Added last.fm badge option
  • Improved options page
  • Added last.fm logos (you should use one)

The changes in 1.0.0

  • Added cURL and fopen support

The minor changes in 1.0.2

  • Added security to file reading function inside class.

The changes in 1.0.3

  • Empty images show up as last.fm image placeholders now.
  • Fixed the compatibility issue with wordpress 2.7 (Their compat.php broke one of my function and i renamed it.)
  • Thanks to Tom for informing me that last.fm started to use 64×64 images instead of 50×50. Thats also changed.

The changes in 1.1

  • Added caching support
  • Changed Last.fm API v1.0 code to v2.0 code
  • Fixed “Now Playing” code

200 Comments

Add Yours
  1. 7
    Elizabeth

    Hi!
    I really like this plugin! I installed it yesterday and it worked fine. Today, I looked at my page and where the plugin should be I got this message:
    “Warning: Invalid argument supplied for foreach() in /home/patra344/public_html/winb/wp-content/p

  2. 10
    Taha Paksu

    @Elizabeth: Ok. This happens when your feed is empty or includes only one song played. I’m going to fix it right now. When it’s finished, you can update your plugin from wordpress directory. Thanks.

  3. 13
    Topuz

    Hi, I really like this widget, it gives away the feeling of communication.

    I have some questions & suggestions tough.

    1) It would be nice if the widget would download artist images when there is no album cover availible. That would be very usefu

  4. 14
    Jess

    This is a great plugin, very well done! I just have one complaint…a plugin title or song/artist title that has an apostrophe shows up like this:

    Ex. What I’/m Listening To
    Old 97’/s

    This also causes the album art to not show up if the song title

  5. 17
    Emz

    Whenever I add the widget, after putting in my username as-is, the result on my blog is:

    This username does not exist, or the feed service is down..

    Another last.fm plugin is working fine (therefore reading the feed), and I’ve been trying t

  6. 19
    M

    I love this plugin but for some reason it is not formatting right at all in my sidebar! I’m still very new to WP so I’m clueless as to how it can be repaired. Any help would be great. Thanks!

  7. 22
    Taha Paksu

    Well thank you for your feedback. But how can a web server don’t support file_get_contents 🙂 some hosts don’t support cURL and some dont support file_get_contents. I think i should add support of both systems. Thanks.

  8. 23
    Kyotoweb

    Hi 🙂
    First, I would like to thank you for such a great plug-in 😉 It’s user-friendly and it works nice.
    I just wanted to know if it’s possible to remove the “profile” part of your plugin ? ’cause I just want to show the last played song, and not neces

  9. 24
    Kyotoweb

    Well, I finally managed to by editing the plug-in himself 😉 Putting all the settings to false was still showing my name & status ( User ) so I deleted it from the root 😉
    Thanks again for your plugin !

  10. 27
    Taha Paksu

    @Kyotoweb: I don’t know what causes this error. Maybe it’s the same error with hosts which don’t support file_get_contents. In next release I will add a different get function. Tomorrow maybe.

    @jocuri: Thanks for using it.

  11. 28
    beetFreeQ

    Hi there! I have exactly the same problem – “This username does not exist, or the feed service is down”. Would love to see a new version of the plugin that works on my blog like the other last.fm-plugins do – because your widget looks the best!

  12. 31
    Kerem

    Selam,eklentiyi güncelledikten sonra bu hatayı veriyor…

    Eklenti etkinleştirilemedi, çünkü önlenemeyen bir hataya sebep oldu.

    Parse error: syntax error, unexpected T_RETURN in public_html/wp-content/plugins/lastfm-rps/simplexml.class.php o

  13. 36
    beetFreeQ

    Yep, it’s solved now 🙂 – works very nice. Now, that I can use the plugin, I already have some ideas for new features, if you don’t mind 😉

    These are my suggestions:

    – option to disable the stylesheet at all. That way I could have the styles in my l

  14. 42
    Sammy

    When I install the plugin, add it to my widget list and then enter my username I get this error in the widget box: “%BEG_OF_TITLE%Last.fm RPS%END_OF_TITLE%” and nothing displays on the homepage.

    I have tried deactivating and reinstalling. Doesn’t work.

  15. 45
    Sammy

    Hi Taha. Nope it doesn’t work in other themes either. Basically what I’ve done is – downloaded the program, uploaded it, activated, put it in my widgets, edited the source and then in the widget box it’s come up with the above error.

    In the actual web

  16. 50
    Bob S

    Please permit me to ask a related question: I’m looking for a WordPress plugin that will run once a day and automatically create a blog entry listing the songs I’ve listened to in the last 24 hours. Do you know of such a plugin? Thanks!

  17. 52
    Éric Senterre

    Hi!

    I just installed this plugin a week ago and I really like this plugin, it works really nice and the output is just perfect!

    But since yesterday, the plugin only tells me : “This user has not played any songs yet.” I don’t know why. FYI, you can

  18. 54
    gordie

    hello, I’m trying the plugin (wordpress 2.6 beta 2) and get this error when activating it :

    syntax error, unexpected ‘}’ in F:\web\BENOITGREANT2\blog\wp-content\plugins\lastfm-rps\lastfm.php on line 438

    any solution ?

  19. 57
    harry

    hi,

    i tried to install but i got this error

    Fatal error: Call to undefined function: wp_register_sidebar_widget() – —————–

    I am using K2 themes…and K2 sidebar widgets…please help me.

  20. 62
    Joel

    Actually, my install worked fine with 2.6. I’m just now having problems, and blaming it on Last.fm’s updates. Might want to check out whatever they’re messing with over there.

  21. 63
    Giofilo

    Great plugin!

    There’s a little problem with XHTML validation: when I put the widget, the W3C system says that there are 10 errors.

    It can be easily fixed adding the “alt” description to last.fm logo and closing the “img” tag with a “/” in the file l

  22. 64
    Taha Paksu

    @Joel: Yea Last.fm is a little busy now 🙂 I think the design was better before.

    @Giofilo: Thank you. I’ll fix it in the next release when i have more time to release a new one 🙂 I’m working in a company now and this was a spare time hobby for me 🙂

  23. 65
    gordie

    @Taha Paksu :
    finally founded what was causing the problem on my blog :
    Your first line in lastfm.php is
    <?
    and not
    <?php !!!
    Now it is working fine !

    Thanks.

  24. 66
    gordie

    PS : and I added THIS on the top of the lastfm.php file

    if ($_REQUEST[‘page_id’]!=347) {
    return;
    }

    to show it only on page #347.
    I don’t know why; but if (!is_page(‘347’)) does not work.

  25. 68
    Blackhouse

    Heya,

    Could you add an option (or make it default), to truncate very long titles? Really long titles (or artists) really mess up the layout 🙂

    Thanks in advance!

  26. 69
    Taha Paksu

    @Blackhouse: Sorry I have no time nowadays for updating this plugin. Maybe later..But you can try playing with css and search for how to use the “overflow” property of css. That may be useful for you.

  27. 71
    Blackhouse

    @Taha Alright I understand, no problems, with a little tinkering I’ve managed to do it myself with a little truncate snippet. It probably isn’t too pretty, but it works 🙂

  28. 76
    Taha Paksu

    @Alejandro Urrutia Daglio: I dont know what could be happening. If there are any error messages can you please mail to me or write it here? Maybe you should get the old version from wordpress.org if thats working?

  29. 83
    Joel Goodman

    Hey Taha,

    The plugin’s come a long way! Thanks for sharing it and for all of your hard work. I’m in the middle of a redesign and I’m hardcoding my sidebars (non-widget enabled). Is there any way to specify in the tag not to show the badge? I really jus

  30. 84
    Taha Paksu

    @Joel Goodman: yea there is. but i didnt add that as a variable of the function. maybe i forgot. but you can open lastfm.php and there are the settings at line 18. it looks like :

    [code]$settings = array( “showavatar” => true,
    “showrealname”

  31. 85
    Joel Goodman

    Brilliant. That worked. It does, however still show the user status (subscriber, etc.) and the Last.fm username no matter what. Which is fine for me… I decided I’d like to show my scrobbled tracks anyway. Gotta do some styling on it though. Thanks!

  32. 86
    Jeremy Swearingen

    Is there a way to make the album art larger? I changed the values in the CSS file to 80 pixels on each side but it resulted in blurry images because I was just scaling up the original 50×50 images. Then I looked in the lastfm.php file in hopes of finding

  33. 88
    Taha Paksu

    @Jeremy Swearingen: Jeremy there’s a way but you need to change the thumbnail source because this script is directly getting the original 50×50 images so there’s a 130×130 option too i think. you should edit the core and find the last.fm image links and t

  34. 96
    Taha Paksu

    @Marcin: I think that’s something about your theme’s css file. please be sure if there are any float:left or float:right in your sidebar css.

    @Christer Danmo: Yes Christer I know that situation but I don’t know how to fix that 🙂 Maybe you can specify

  35. 97
    Christer Danmo

    hmm.. I`ll have a look at it. Tables do expand auto 😀

    One more question, is it possible to make the plugin cache the images and not sync with last.fm every min? My blogg loads like 5-10 times slower than usual when I turn the plugin on :S

  36. 98
    Taha Paksu

    @Christer Danmo: Yea the caching system is what everybody wants but i haven’t got any time to work on it. Maybe later. But I dont know when. I started working 4 months ago,nowadays I’m so busy and I don’t know when it’ll end 🙂

  37. 102
    Taha Paksu

    @hutzi: if that situation is about the vertical scrollbar please uninstall the plugin and look if the vertical scrollbar is visible. if it’s not, the re-positioning of the form is because your last.fm list causes the vertical scrollbar to get visible. if

  38. 103
    Jason

    Hey there,
    Nice work – like it, however I get “This username does not exist, or the feed service is down” even though it is the correct username.
    Any ideas where I look to fix this?
    Thanks in advance.
    Jas

  39. 104
  40. 108
    Vibeke

    Hi

    I just installed the plugin in WordPress 2.7 and it works very well. In the beginning I had the same problem as Christer Dammo, but I just changed the height in the lastfm.css file (line 2) to 185px and now it works fine and looks very nice. The lin

  41. 114
    Andrè Nakamura

    Hi Taha… when I use your plugin I see this text in the sidebar, right under the widget:

    [code]Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in /web/htdocs/www.beerdelirium.com/home/wp-includes/compat.php on line 105[

  42. 116
    Andrè Nakamura

    I tried, but the situation hasn’t changed and the message is still there.

    Another thing I forgot: when I listen to tracks last.fm doesn’t recognize (because of the tag, I suppose) it appears a text field “Cover image for _____ ” instead of the little i

  43. 117
    Eloy

    Hello Taha
    First of all… great Plugin, thanks. I have the same problems like Andrè Nakamura. First of all this ugly message (WordPress 2.7.1):

    Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in /home/www/web3/html/el

    • 118
      Taha Paksu

      for the first problem (line 301 in lastfm.php) change

      echo "<div id='lastfm_recent_comment'>" . stripslashes(htmlspecialchars_decode($text)) . "</div>";

      to

      echo "<div id='lastfm_recent_comment'>" . stripslash

  44. 121
    Hubert

    This is the Error i get:
    __________________________________________________

    Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL /htdocs/blog/wp-includes/compat.php on line 105

    This I used in my Sidebar – Code:
    _____________

    • 122
      Taha Paksu

      Try this.

      starting at line 130 there’s a code block:

      if(!function_exists('htmlspecialchars_decode')){
      function htmlspecialchars_decode($string,$style=ENT_COMPAT)
      {
      $translation = array_flip(get_html_translation_table(HTML_SPECIALCHARS,$style

  45. 128
    Dan

    G’day. Great plugin. Just wondering which lines of code would I remove so that it doesn’t load or display the album art? Also, which lines of code would I remove to remove the last.fm logo?

  46. 130
    Dan

    Thanks for the quick reply. I tried to delete even just the first part, and now my site doesn’t load, just white, but when the code is there, it loads.

  47. 132
    Taha Paksu

    you should remove this lines

    [code]if(trim($album->scalar)){
    $albumimage = get_album_art(stripslashes($album->scalar),stripslashes($artist->scalar));
    }else{
    $replace = array(” “,”&”,”/”);
    $with = array(“%20″,”%26″,”%2F”);

  48. 134
    Aditya

    Hi I am having a rather particular problem with my blog. I think I have already sent you a message about it before, but here goes anyway. The alt text displayed on the album art isn’t quite working correctly. Like I just listened to Guns N’ Roses – Chines

  49. 136
    Aditya

    Apologies Taha. I was messing around with another plugin at the same time.
    Can you tell me how can I display the album art inline without the text, and how I can hide my profile information? Seems a bit complicated from the looks of it. All I want to sho

  50. 137
    clay

    Hello, I’m trying to get the plugin integrated into my about page. My theme does not support widgets, and I’ve got the plugin on the page in the place where I want it, but the spacing and horizontal rules seem off. Can you point me in the right direction

  51. 138
    Taha Paksu

    @clay: you need to play with the lastfm.css file to adjust the width,height etc.. and for the badge thing, open lastfm.php and near the end you should see;

    [code]
    $options = array(
    ‘title’ => ‘Last.fm RPS’,
    ‘size’ => 10,
    ‘serversec’ => 0,

  52. 139
    felix

    I receive an error when is use your plugin. my last.fm profilename is felix-leiter . if i activate the plugin as a widget i receive this error: “This username does not exist, or the feed service is down.” when i use an nonexisting username i also receive

  53. 141
    Taha Paksu

    OK. The problem is about your server. Your username doesn’t cause any problems. Check if your server supports the standart PHP XML extension.

    Create a php file and write this inside it:

    < ?php echo phpinfo();?>

    then upload it to your host and run

  54. 142
    felix

    hello,

    these are my the phpmyinfo from my hoster, which is bplaced.net.

    XML Support active
    XML Namespace Support active
    libxml2 Version 2.6.32
    XML-reader &-writer active
    DOM/XML enabled
    libXML support active
    libXML Version 2.6.32

    • 143
      Taha Paksu

      ok. lets try this. open an empty php file on your server and try this code :

      [code]<?
      include_once “simplexml.class.php”;
      $sx = new simplexml;
      $results = $sx->xml_load_file(“http://ws.audioscrobbler.com/1.0/user/felix-leiter/recenttracks.xml”)

  55. 144
    felix

    hello,

    i get these result from your code:

    “Parse error: syntax error, unexpected T_CLASS in /users/leiter/www/wordpress/test.php on line 2”

    these are the phpinfo results:
    SimpleXML
    Simplexml support enabled
    Revision $Revision: 1.151.2.22.2.45

  56. 146
    DelilahMused

    Hi! I’m trying to use this widget in my blog and I get the following error in the sidebar (after which clickable links to the music are there): Warning: gzinflate() [function.gzinflate]: data error in /home/passcreek/www/delilahmused/wp-includes/http.php

  57. 156
    Bart

    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!

  58. 158
    Ryan Cain

    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 $dateD

  59. 161
    Neal

    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.

    • 162
      Taha Paksu

      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

  60. 167
    Taha Paksu

    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 displayin

  61. 186
    Brian Schroeter

    Hey there!

    I seem to be getting the following error — may you help?

    Catchable fatal error: Object of class stdClass could not be converted to string in /home/exit3/public_html/exit3/wp-content/plugins/lastfm-rps/lastfm.php on line 190

    Thanks!

  62. 187
    Taha Paksu

    try replacing

    $album = rawurlencode(utf8_encode(str_replace($replace,$with,stripslashes($album))));

    with

    $album = rawurlencode(utf8_encode(str_replace($replace,$with,stripslashes((string)$album))));

    on line 190.

  63. 188
    TAKTAK

    Hey, I’m getting an error when I try and install it 🙁
    All other plugins install fine but for some reason this won’t, i’ve had it installed before, but changed host and updated wordpress. Any ideas?

    Plugin could not be activated because it triggered a fa

  64. 192
    Sue

    I like your plugin best out of many I tried, but it sometimes shows one more item than what I have set in “list size” If I set list size to four, sometimes it will show five items, and so on. Any fix for this?

    At first I had the plugin set to show my use

  65. 193
    Taha Paksu

    Hi Sue, thanks for trying my plugin first. Second, I didn’t catch this bug before and I’m not developing this plugin further. That was written 4 years ago. The overlapping issue would be fixed with CSS I think. And caching is saving the response from last

  66. 195
    Taha Paksu

    Sorry, I don’t have much time to work with this plugin. Maybe later (don’t know when) I’ll rewrite it with new features. So if you want some extra features, feel free to post here. And thanks for using it.

  67. 196
    Geburtstagsspr

    Hello! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for
    my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *