Display Last.fm Scrobbles On Your Site

This entry was posted 1 year, 6 months ago.

Disclaimer: I didn’t write this script; I’ve modified David Kadavy’s TwitBlog script^ to display your Last.fm scrobbles and the time the track was scrobbled.

FOR NON-WORDPRESS USERS:
Before you can use this on your site, you’ll need to install MagpieRSS; this script grabs the parsed feed from MagpieRSS and displays it in a visitor-friendly way. :) (Don’t know how to install MagpieRSS?)
WordPress users don’t need to install MagpieRSS. :)

Download the Last.fm.txt file (right click on the link » Save As) and open the file in Notepad.

Press Ctrl + G and type in 12 (this will take you to line 12).
Change /home/USER/public_html/magpierss/rss_fetch.inc to the server path where the rss_fetch.inc file is. If you don’t know where it is, just change USER to your cPanel username.
WordPress comes with MagpieRSS installed, so if you will be using this with WordPress, you will need to point the path to go to /home/USER/public_html/wp-includes/rss.php

Go down to line 16 and change /home/USER/public_html/cache to the server path where your cache directory is. If you don’t know where it is but you installed MagpieRSS in your root directory, just change USER to your cPanel username.

Next, go down to line 19 and change http://ws.audioscrobbler.com/1.0/user/lirae666/recenttracks.rss to the URL of your Recent Tracks feed. (Unless you want to display what I’ve been listening to!)
You can find this on your profile, just above the “Recently Listened Tracks” list:

Go down to line 22 if you want to change the amount of scrobbles you wish to display on your site. (I think the most amount of scrobbles you can show is 10.)

For now, leave line 25 as it is. This just sets how many hours ahead or behind your server time is, compared to Last.fm’s server time.
If you find that the times are off, change +4 to how many hours off the times are.
For example: if the time the track was played is showing up as 9am, when you played it at 11am, change +4 to +6. Similarly, if the time is showing up as 11am, when you played the track at 9am, change +4 to +2.

Now resave the file as “last.fm.php” and upload it to the root directory of your site.

To show the list on your site, all you need to do is include the last.fm.php file in your sidebar: <?php include("/home/USER/public_html/last.fm.php");?> (change USER to your cPanel username).

Related Entries:

  1. I’ve been working all day

Tags: , , , ,



2 Comments On “Display Last.fm Scrobbles On Your Site”

  1. Anthony March 19, 2009 at 1:39am

    Very Cool! Thanks for this. I am going to try this soon. What about displaying more than one track at a time?






Comment on “Display Last.fm Scrobbles On Your Site”





 

 
 
Copyright © Carlee Tibbs 2006-2009. · Archives · Search · Sitemap · Top ↑