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.
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+.
- At the top of the index.php file is the SQL for creating your database.
- After you create your database, put your database settings in the config.inc.php file.
- Export your iTunes music as ‘Library.xml’ and put the Library.xml file into the itunes_stats folder.
- Load the index.php page in your browser and click on the “Load data” option to import the XML into MySQL.
- 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.
looks nice.. but i can’t find the download link 🙂
It’s the “Download” text right below the screen cap.
Modular Reports for iTunes Stats
It occurred to me that if I really wanted people to contribute reports for iTunes Stats, I should make it a little easier to build the reports separately. I’ve posted a new version that takes a step in that direction.
Reports are now …
Hey there… i’m working on a version that allows PHP 4.3.X since most webserver don’t have PHP 5 yet and the user can’t help this.
i’m just about done and will email you when i am done.
wow. very cool. from concept to program in 3 days! nice.
[…] Either way, I’ve posted my iTunes library reports using Alex’s app. alexking.org: Blog > iTunes Stats [Alex King] […]
Check with your ISP, mine allows php5 by either using .php5 or by inserting the following into the .htaccess file within the itunes_stats folder: ‘AddHandler application/x-httpd-php5 .php’
You might also be able to install both locally and use similar trickery.
I think my XML file is too large, I receive a lot of errors ‘out of memory’, the first few lines
Warning: Memory allocation failed in /www/htdocs/php/itunes_stats/index.php on line 48
Warning: Library.xml:169017: parser error : Memory allocation failed : xmlSAX2Characters in /www/htdocs/php/itunes_stats/index.php on line 48
This is great! Thanks.
it was tough to get the thing in the widgets ans i still havent gotten it and so ya im stuck
[…] iTunes Stats (different from above) This method will show you the artists with the highest ranking, weighted by the number of rated songs. Possibly more. […]
nice tool – great work !
on my localhost its working !
on my www site i have only PHP 4.4.4
run on localhost php5+ and copy/paste generated html code directly on your www homepage (with older php version)
(webserver localhost with
so i found another very small and simple script to convert itunes xml to html
iTunes XML Playlist Reader
from Richard James Kendall
Great stuff. Had to change php.ini (got a timeout during import) but after that no problems.
thanks! i have 34000 songs, 15000 of which are rated, this is exactly what I was looking for. it revealed some very interesting information. i too had to change max_execution_time