iTunes Now Playing
Posted on May 31, 2008 at 10:36 PM
I've wanted to include a little blog candy for a while, and this weekend I made it happen. I like how you can see what's playing on my iTunes in iChat or AIM (Adium actually). I wanted to do the same thing on my blog.
I found a nice plugin for iTunes that enables this. Here's how it works:
- The iTunes plugin creates an XML file with your typical playlist info. You can disignate how many entries are in the XML file.
- The plugin will also export the cover art.
- The plugin will FTP the file(s) to a webserver. It will also ping the server.
- You write the code to make the monkey dance on your webserver.
I started out just reading the XML in the controller and displaying the results. I had some trouble with the values getting lost between the controller and the view. Meh.
Then it hit me, the ping could be an action. So I changed things up a little, and read the data from the XML file when the file is updated. There is only 1 song in the file, so I just take the entry and insert it into the database. A ping could happen multiple times for the same song -- it does it each time the song is started. No problem! I updated the model to validate the artworkID is unique (which it is). Bam. Good to go.
There is at least 1 loose end to tie up, but I like it. Check it out -- there is a link in the side nav now.
Comments
There are 0 comments on this post. Post yours →
Post a comment
Required fields in bold.