I always have a hard time choosing favorite songs or bands so I usually default to my current addiction. Right now that happens to be Chimp Spanner. Recently I decided to try to analyze my listening habits a little bit more and figure out what bands have really stuck with me. iTunes keeps track of a decent amount of listening information and makes this very accessible so I thought it would be interesting to use this to calculate some stats. To do this, I wrote a Python script that parses the iTunes music library file and gets statistics on what artists and albums I listen to the most.
Parsing the iTunes music library file in Python turned out to be pretty easy. It is stored as a property list which can be completely parsed using the standard python library plistlib. Plistlib stores the whole file as a dictionary so access is fast and easy. I simply had to iterate through the dictionary and pull the information I needed.
As it turns out I have spent about 84 days listening to my music over the last 3 years or so. I have 28,000 plays and my most listened to bands along with their total listening time and percentage of all iTunes music listening are:
Top played artists by time | Symphony X | 11:7:55:57.489 | 13.35% | | Nightwish | 10:13:17:58.603 | 12.43% | | Queens of the Stone Age | 5:18:2:32.704 | 6.78% | | Cloud Cult | 5:8:53:43.777 | 6.33% | | Kamelot | 3:22:2:50.529 | 4.62% | | Dethklok | 2:14:23:1.718 | 3.06% | | Arjen A. Lucassen's Star One | 2:14:15:51.818 | 3.06% | | Muse | 2:12:40:48.849 | 2.98% | | Blind Guardian | 2:12:29:12.134 | 2.97% | | Leaves' Eyes | 2:8:5:58.55 | 2.75% |
I pretty much just listen to a lot of power metal. Probably the most interesting result from this is how much I am willing to listen to the same stuff on repeat. This script is currently living at Github if you want to try it out. It should run without modification on any Mac and will run on PC if you change the path to the iTunes Music Library XML file.
Let me know what your results are!
Great post, I hope to build upon your work … cheers!