I usually try to post to this blog once a week on average. That forces me to try to learn something or learn about something during the week that I can post about.
Sometimes though I have to resort to things that I've been sitting on for a while, like this Python script I wrote called MyMusicReporter.
This program makes use of the id3reader module available here. In other words, the program won't function without this module.
For those unfamiliar with Python, it supports the use of modules, which – as the name implies – is basically allowing the current Python program to take advantage of another, pre-existing Python program. At least that's how I understand it for now …
Anyway, MyMusicReporter does the following:
- it asks you to point it to a root directory on your computer,
- it then finds all the MP3s in that folder and its subfolders,
- it makes an XML file in the same directory as MyMusicReporter called MyMusicReport.xml which contains the Title, Performer, Track #, Year, and relative file path for each MP3,
- it makes an XML stylesheet in the same directory as MyMusicReporter called MyMusicReport.xsl which makes MyMusicReport.xml look pretty in your web browser.
Here's an example of how the XML looks with my home-grown schema:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="MyMusicReport.xsl"?> <MyMusicReport> <mp3> <title>R2-DVD2</title> <performer>Nitin Arora</performer> <track>1</track> <year>2008</year> <path>r2_dvd2.mp3</path> </mp3> </MyMusicReport>
Anyway, here's the source code for MyMusicReporter.py.
You assume all responsibility for use.--------------