this blog is

26 December 2006 @ 9pm

Comments Off

iTunes Ratings Statistics

What is it?

This is a script that will slice’n'dice your iTunes music library and tell you the distribution of rated tracks. You find out how many have one star, how many have two, etc. You also find out the percentages for each rating, as well as the cumulative percentage. Here’s some sample output:

Here are some statistics from your iTunes Library:

4339 tracks, 613 (14%) rated

Cumulative % of rated
Number % of rated Actual Target Shortfall
Tracks rated 5 stars: 6 1 1 5 4
Tracks rated 4 stars: 136 22 23 15 -8
Tracks rated 3 stars: 277 45 68 50 -18
Tracks rated 2 stars: 160 26 94 90 -4
Tracks rated 1 stars: 34 6 100

Why is this useful? See the accompanying blog post for more justification, but basically the idea is to tell you the distribution of ratings in your library in order to get some idea of how you are rating the tracks. Armed with this knowledge you can adjust the ratings to meet targets. For example, if you wanted to reserve a five-star rating for the top 10% of tracks, you might want to know the percentage of your current five-star tracks in order to know whether to demote some of them to four-stars, or to promote some of the four-star tracks to five.

Installation / Usage

Right-click on itunesratings.xhtml, choose “Save As…” (or “Download Linked File To…”), and save to your iTunes folder. This is the folder with your iTunes Music Library.xml file. On MacOS this is ~/Music/iTunes, on Windows this is likely to be My Documents\My Music\iTunes.

From there, you should open it in an XSLT-capable browser. Right click on the document and choose “Open With” one of the following tested browsers:

  • Firefox (Windows or Mac)
  • Camino

At this time Safari is not supported. Come to think of it, none of these browsers are supported, I just mean that it currently won’t work in Safari. Internet Explorer doesn’t seem to work either, sorry. Get Firefox.


You can adjust the target percentages for each rating. To do this, just open the document in a text editor. You will see the following lines:

<count-rated rating="100" targetpct="5"/>
<count-rated rating="80" targetpct="15"/>
<count-rated rating="60" targetpct="50"/>
<count-rated rating="40" targetpct="90"/>
<count-rated rating="20"/>

Leave the rating= bits alone, but feel free to adjust the targetpct values. You can also change the order of the ratings, if you are so inclined.


  • 2005-11-03: Initial release

Written by Alastair. Licensed under the Creative Commons Attribution License

Back to Home