Last.fm profiles show quite a bit of information on the listening habits of the user, however it lacks some graphs showing the amount of scrobbles over time. I know there’s a handful of websites out there that have all kinds of graphs and can show you detailed information on most every aspect of your Last.fm library. However, I wanted to implement my own graph generator, one that didn’t have minutes of queue waiting.
At the moment my generator has two options, one where you can see your scrobbles over the course of weeks, months or even years and, if you want, compare it with another user. The other feature I added just recently, the Artist Scrobble History, shows you how many tracks by a particular artist you’ve scrobbled over time, again, you can also compare data between two users.
Because Last.fm’s API probably uses flood control and limits the requests, pulling data from their servers can take up some time, especially if it’s a lot of data (e.g. request a year’s worth) so I added database caching which speeds up the process a lot if you want to review earlier requested information. Currently the form will also auto complete artist names, granted, its implementation is not exactly great as it just pulls already cached names from the cache database rather than from Last.fm’s one. I could use the API’s artist search function but then I’d be stuck with the slow requests again.
I first tried the lazy way, copying all the generation code into a separate file and have AJAX pull that in, however since the JS wasn’t executed the chart wasn’t drawn and you didn’t see anything. So I had to use the eval() function for it to work. I’ve read that’s not really a great idea so even though it works this way, I’ll make a better, less hack-y version sometime.
In the future I might add another feature that plots how your genre listening habits have changed. If you have any other ideas feel free to post them in the comments and I’ll see if they can be added as well.
Leave a comment