Last.fm Real-time statsI really like last.fm, but one thing that has long bothered me is the waiting. Because admit, Last.fm is not particularly fast... Not when serving their pages, nor when it comes to updating the stats. A 24 hours delay in generating the week stats is not unusual and even if it were real-time I wouldn't be really satisfied. As a dedicated listener I like to know where I stand for the current week.
So the first thing I created was a script that could download a users 10 most recent tracks from the Audioscrobbler web services and store new tracks in a database. Then I edited it to accommodate multiple users and run it as a cronjob. As the usage increased, so did the load and polling >10 feeds every minutes isn't rather efficient. So assuming it's highly unlikely for anyone too play >10 tracks in <12min I made the script schedule visits based on the number of new plays it found during the last visit with a maximum interval of 12min. Now it's fairly stable and the resulting stats show only minor and incidental differences from the last.fm stats.
Go View The Last.fm Real-time Stats >>
Created by Paul Cornelissen (pcmadman)
Visit pcmadman's last.fm profile or contact him at pcornelissen -at- gmail.com