• Is this even possible?
    1 replies, posted
Okay, this may or may not make sense. I run a site, [url]http://www.tapmusic.net/lastfm[/url], which is used to create 3x3 collages of your top 9 albums or artists over 7 days, 3 months, etc. I use the last.fm API, obviously. Right now I am using $userClass->getTopAlbums($methodVars) (and getTopArtists) to do this, each in separate files. It works fine. My problem is that many people have expressed interest in having it done by time rather than plays, similar to [url]www.normalisr.com[/url]. However, I'm at a loss as to how to do this. I think it might be possible if I use two different $userClass things in one file, but is this even possible in PHP, and how much of a pain in the ass would it be? I've been at this for a few hours with no progress. Here's a pastebin of the code: [url]http://pastebin.com/Qi6FEUaP[/url] If I can at least figure out how to make it access the duration of each track...then I'll figure out the rest from there (I hope).
Ok, so I decided to take a look for you. I pulled up the [URL="http://www.last.fm/api/"]lastfm api [/URL]on their site. You seem to be doing through user, but you should be doing it through[URL="http://www.last.fm/api/show/library.getTracks"] "library.getTracks"[/URL]. Taking a look at the response it gives, it gives you duration and play count. Set the limit to 200 and pull it in, may take a bit of time, but should take less time then your script currently takes. However you may only need to pull in 9 tracks because you only want 9 images. (Also does the same if you ask for album or artist information, but not duration).
Sorry, you need to Log In to post a reply to this thread.