Recently I decided I wanted to perform a statistical analysis of all the music I've ever played in iTunes. This is non-trivial, as iTunes only stores the date and time each song was played last and does not keep any log showing previous plays.
With several copies of my iTunes library file, I can reconstruct the overall history. Luckily, I am using Time Machine and can therefore retrieve snapshots of the library. This is enough to reconstruct the history going back over a year.
The only problem is that Time Machine does not back up the .xml files, only the proprietary .itl files used by iTunes natively. This means that I must perform all the following steps:
- retrive historical iTunes Library.itl files
- convert each .itl file into the corresponding .xml file
- parse each .xml file and build a log of songs played based on the last played parameter for each song
- fill in any blanks with fuzzy data (for instance, if a song has been played twice since the previously-determined date, make a guess as to when the last-1 listening may have occurred)
The full description of each step is detailed in the pages that follow.