I had some requirements to do some advanced queries on my iTunes library. Searching the web I found an interesting script that I debugged and modified. This is a PHP script that will read an iTunes library file (iTunes Music Library.xml), create appropriate database tables in a MySQL database and then dump the tracks in the xml file to this database table. The script is not refined or anything but served its purpose for me. To get it up and running quickly:
- Make sure you’ve got PHP and MySQL installed properly. Fast track is to install MAMP.
- Create a database and userid/password for your new database. Give the user all privileges on this database.
- Fill-in the details from two in the script below.
- Put the script in an appropriate location (my location is MAMP\htdocs\itunes\itunes.php).
- Put your browser at the script and behold …. your itunes track in a database table.
- Use any appropriate tool to query the database (I use CocoaMySQL).
Good luck.