In an effort to add some personality to this site I thought I’d list my favourite songs. iTunes provides a mechanism for users to rate songs, by giving a song 0 to 5 stars. After years of listening to music, and rating it, I have a large collection of rated songs. Manually copying and pasting each song into an HTML file seemed inefficient and time consuming, enter Python.
In an effort to learn Python, and parse my iTunes library, I created pyItunes, a Python module. pyItunes includes three classes that can parse the “iTunes Music Library.xml” file and convert it into list of Song objects. I decided to roll my own micro-xml parser that can only parse the iTunes xml file. Although, reinventing the wheel, especially an XML parser, is likely a horrible idea I felt it would be a good learning experience. In future versions I may swap an existing XML parser that is much faster and more efficient than the one I created.