iTunes Stats

Well, I got curious so I went ahead and wrote up a little script to grab some basic stats from my iTunes data. I figured others might be interested in this as well, so I’ve packaged it up as a download.

iTunes Stats


What it does right now:

  • Imports a Library.xml export from iTunes into a MySQL database.
  • Runs a couple of queries as example reports.

This is totally unpolished at this point and requires PHP 5+ and MySQL 4+.


  1. At the top of the index.php file is the SQL for creating your database.
  2. After you create your database, put your database settings in the file.
  3. Export your iTunes music as ‘Library.xml’ and put the Library.xml file into the itunes_stats folder.
  4. Load the index.php page in your browser and click on the “Load data” option to import the XML into MySQL.
  5. Click on reports, etc.

I’ve added forums for ideas/mods/support. I’d love for you to write your own reports and send them in or post them in the forums.

This post is part of the project: iTunes Stats. View the project timeline for more context on this post.