Tracking Tunes

WATCHING:
Beerfest
Jay Chandrasekhar, director

Well, this is not one for the Oscars.

It’s Animal House meets Fight Club, mixing in drinking games we all did in college.

Not bad, but – for an over-the-top comedy – it just didn’t have that many laughs. Stereotypes, tits and ass, implausible situations and so on.

Not a waste of time, but not a productive use of same.

But it’s Saint Patrick’s day, so a movie celebrating beer is appropriate.

All movies

I’ve added a new feature to the blog – a “Listening To…” list in the side rail.

Basically, this is a list of my most recent listens on iTunes.

Doesn’t sound like much, but there’s more to it than meets the eye.

I’ve seen such lists on other sites; the one I recall right now is the “Now Playing in my iTunes” on kottke.org.

I’ve often wondered how it was done; if there is a 3rd party app for such and so on.

I really didn’t look around much; I just used this excuse to learn some AJAX.

Here’s how my listing works:

  • My iTunes runs on my main Windoze box. I run a script (shell script calls perl script) on one of my Linux boxes to pull the iTunes XML file to the Linux box.
  • The perl script then runs over the XML file, parsing out the date played (integer, not scalar time), album, track and artist. This is all done with simple perl; no XML modules are involved.
  • Elements extracted are dropped, pipe-delimited, to a flat file. (This will be all songs in iTunes.)
  • Unix file sort so most recent tracks are at the top.
  • Unix command to retain only top 10 (currently; configurable) items.
  • File FTP’d to this site.
  • When the page is loaded, an AJAX call fetches, parses and presents the data in the flat file.

A cron job runs every hour to re-create the flat file.

At the end, very elegant, but a lot of work went into this. However, it was fun and something – both for songs and re:AJAX – that I’ve wanted to do for some time.

Done! And the damn code works…