LastFM Charts

I made my program to generate charts for any date range from LastFM data available to anybody a few weeks ago and it’s had a positive response, being included on build.last.fm as an interesting extra kindofthing. Though still nobody has feedback or suggestions. Maybe in itself it’s relatively complete and I should think of other, related bits and pieces. Anybody?

I’ve made it automatically updating, so you only need to add your data once the very first time you visit, and after that it’ll check whether there should be new charts available. Maybe it should only happen a few days into the week – LastFM never get the charts out on time after all..

That and I added a few extra quick links, to 3/6/12/24 months previous. No more ‘wait a month for charts to refresh’ ;-). I should totally see if I can make this into a greasemonkey script..

PHP’s strtotime function is no end of brilliance – strtotime("-6 months") and strtotime("last sunday") are genius conceptions.

Comments (21)

  1. Declan wrote::

    Excellent facility. This is what I have wanted last.fm to do in the first place. Cheers.

    Wednesday, March 19, 2008 at 10:52 am #
  2. mr wrote::

    Cool.

    How about Unicode support? I can’t view foreign characters on this.

    Wednesday, March 19, 2008 at 3:55 pm #
  3. sam wrote::

    Oh thanks for bringing that up, MR.

    Wednesday, March 19, 2008 at 4:58 pm #
  4. brandon wrote::

    I like this script, would be nice if there were smaller versions that could be added to your user profile page for example =)

    Saturday, March 29, 2008 at 1:26 pm #
  5. m2wester wrote::

    1) nice script :)

    2) feature request: could you include the total number of tracks played in the selected timeframe somewhere in the output?

    3) I think you should say somewhere that it’s based on weekly charts… just to clearify.

    4) bug: i occasionally get this message:
    Couldn’t read file: data/m2wester/weekly_charts/1174219200-1174824000.xml
    however when I display the same chart a second time, it’s gone.

    Thursday, April 24, 2008 at 8:14 pm #
  6. sam wrote::

    No. 2 is a good idea, I’ll add that :-)

    As for 4. – some weekly charts have errors on Last.fm’s side .. the type I can’t do anything about. Then sometimes something goes wrong when the script is pulling the data. Perhaps I should add a note about it to the description.

    The error here is corrected, I’ll make it automatic when my exams are over

    Thanks for the comments!

    Monday, April 28, 2008 at 12:31 am #
  7. Elan wrote::

    Hi there, this looks pretty neat!
    One question though: since I found this as an article of the Greasemonkey group, would it be possible to have this work as a greasemonkey script? that would make this utility work from a users page, I don’t know about others, but I think I would like it myself.

    Thursday, May 15, 2008 at 6:20 pm #
  8. Emz wrote::

    Hmm, I can’t seem to add my data for some reason. I get these errors:

    Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/aradnuk/troublewithdreams.com/scrobbler/user.php on line 37

    Warning: file_get_contents(http://ws.audioscrobbler.com/1.0/user/perfectstorm/weeklychartlist.xml) [function.file-get-contents]: failed to open stream: Connection refused in /var/www/aradnuk/troublewithdreams.com/scrobbler/user.php on line 37

    Warning: Invalid argument supplied for foreach() in /var/www/aradnuk/troublewithdreams.com/scrobbler/user.php on line 59

    Sunday, May 18, 2008 at 7:35 pm #
  9. Emz wrote::

    Just to let you know, it is now working for me!

    Tuesday, May 27, 2008 at 9:15 pm #
  10. Tom wrote::

    This is excellent, what i’ve always wanted with last.fm. I might be being dumb I’m not sure, but could you have the same but for tracks as well as artists?

    Saturday, May 31, 2008 at 7:19 pm #
  11. sam wrote::

    elan – maybe, if i find the time in the summer. though i’m looking forward to seeing what last.fm make of the charts come the new site design .. they’ll always be up-to-date woop
    emz – not sure what that was about but glad it’s working again.
    tom – yeah, that’s a cool idea, i’ll add that when i rewrite it in a week or two

    Tuesday, June 3, 2008 at 2:33 am #
  12. Bloopy wrote::

    Looks like I’ve discovered a bug in your program. The band 1989 is replaced by a 0. I’m guessing the same thing would happen to any band whose name is a number.

    Otherwise, nice program!

    Thursday, June 19, 2008 at 4:55 am #
  13. Tom wrote::

    Hey mate, any news on adding the tracks too yet?

    Wednesday, July 9, 2008 at 10:28 pm #
  14. Jack wrote::

    This is ace. Best last.fm app I’ve seen

    Saturday, August 2, 2008 at 11:59 pm #
  15. Tore wrote::

    Hey, is it possible to do this for tracks, too? I’d like to go back and see what songs, not artists, I listened to at given time periods in the past.

    Alternatively, do you know of other Last.fm tools that do this?

    Thanks!

    Tuesday, August 12, 2008 at 2:12 am #
  16. sam wrote::

    It’s almost there, promise!

    Tuesday, August 12, 2008 at 4:29 pm #
  17. Tom wrote::

    Hey again,
    MASSIVE thanks for this project now with tracks – its an amazing tool, does exactly what I need :)
    Tom

    Thursday, September 18, 2008 at 12:15 pm #
  18. Steve wrote::

    Hey I just found your charts and I wanted to say this is awesome! Thanks.

    Thursday, March 4, 2010 at 10:51 pm #
  19. Justin wrote::

    Definitely the absolute best last.fm api app out there =)

    Saturday, July 31, 2010 at 7:06 am #
  20. 14ws wrote::

    Program writes that I have an invalid username. My username is 14ws. What’s happens?

    Monday, March 7, 2011 at 11:02 pm #
  21. sam wrote::

    I took Last.fm’s username requirements as correct.. if you sign up now you’re told

    “Your username should be between 2 and 15 characters, begin with a letter and contain only letters, numbers, ‘_’ or ‘-’.”

    It should work now.

    Tuesday, March 8, 2011 at 10:43 am #