Tuesday, April 03, 2007

Last.FM gadget

This past weekend I have been working on a windows vista gadget for last.FM

Most of Saturday was spent fooling around with javascript for the first time in a long while. Trying to find syntax errors using notepad. Ugh. I finally relented and downloaded visual web designer. Next time I play with it I will hook up the script debugger. The rest of the time was spent parsing the XML and text responses that the last.fm 'APIs' respond with. It is a shame that the whole thing is not done in XML - the np.php (now playing) for example just responds with name value pairs in text. Not so nice. Plus it seems to me that the whole shebang is a little iffy at times. Just not responding to requests.

I will have a bit more of a look at the last.fm source tomorrow, for now I have only really looked at the myLastFm source code... Perhaps going back to the original source would be better. I want to know for instance whether the 'real' client polls the np.php for track updates (say every 5 seconds) or if it has some other way. I had envisioned getting the remaining track time and then waiting until around about the time the track should finish and then requesting new track info. But time remaining field seems to have been left out of the response (the myLastFm client looks for it too).

So for now I have working:

  • Basic gadget functionality (icons, page sizing, basic css and js)
  • Username and password configuration.
  • Password hashing.
  • Recently played tracks fly-out.
  • Now playing info (artist, album + cover art, track).

I think actual login (send username and password hash, receive sessionid and stream address) is close to working - just that when I was testing it last night the whole last.fm site stopped working, now np.php was not returning etc. Later it worked again, but I was past the stage of wanting to code - Guild Wars...

No comments:

Post a Comment