Thursday, 22 March 2007

Ajax on Nintendo DS (Part 2)

For my reference and anyone who's playing around with AJAX on the DS, here's an example of AJAX on the DS...

ajaxexample.html

Again, big thanks to tamwayne over at the Opera DS Forum

The example creates a simple webpage that shows the track name and album art for the track currently playing in iTunes. The data comes from an XML file named 'status.php'. Status currently returns something like the following

<status>
<!-- I had a bug with DS not liking
to read the first child of DOM element ... weird -->
<filler>filler</filler>
<trackdatabaseid>1234</trackdatabaseid>
<trackname>Idioteque</trackname>
<tracknametrunc>Idioteque</tracknametrunc>
<trackartist>Radiohead</trackartist>
<trackartisttrunc>Radiohead</trackartisttrunc>
<trackalbum>Kid A</trackalbum>
<trackalbumtrunc>Kid A</trackalbumtrunc>
<trackimage>http://10.0.1.2/itunes/work/1234.png</trackimage>
<smltrackimage>http://10.0.1.2/itunes/work/1234.sml.png</smltrackimage>
<volume>
<living_room>90</living_room>
<dining_room>60</dining_room>
<upstairs>100</upstairs>
</volume>
</status>

The 'trunc' fields provides truncated versions of associated text, to save messing around in javascript to make it fit correctly - I know, it's a bit of a hack!

How I get this information, generate album images and the control itunes/airport express volumes will be covered in a later post. Once I've tidied up the interface I'll get some screenshots online

No comments: