iTunes Preparation

For the past ten years I have converted most of my CDs to MP3 format and, gradually, a sense of order has evolved. Now I have my collection sub-divided into the following folder structure: d:\mp3\artist\album. This is all good and well but the ID3 tag information in these files isn’t as pretty as my nicely-ordered folder structure, which became apparent when friends, family, and colleagues wouldn’t shut up about the virtues of iTunes and I tried to import my collection.

What I once regarded as a lovingly-ordered collection of music was reduced to rubble when iTunes tried to make sense of it all. It seems that I never before cared enough about ID3 fields in Winamp which resulted in iTunes separating “JS Bach” from “Bach” and “Bach, JS”. Needless to say, I was not impressed, and quickly discarded iTunes. However, I have grown tired of navigating through my folder structure in Winamp’s standard Windows common dialogue, so I have finally done something about it and have written a program to tidy-up my entire collection. Introducting: iTunes Preparation.

To get the most out of iTunes Preparation, you should start out by making sure that your folder structure resembles mine -i.e., My Music\artist\album. If yours differs from this format, then iTunes Preparation won’t do you any good (unless you download the source code and modify it to suit). The other thing you should do is create a bunch of text files (I created “classical.txt”, “baroque.txt”, etc) and copy them, as appropriate, into the each artist’s folder. As iTunes Preparation goes about its business, it will use the name of the first (and, hopefully, only) text file in the artist’s folder (minus the extension) as the genre for all MP3 files in that folder and any sub-folders (albums) below each artist. Here’s a full list of what iTunes Preparation will do:

  • The top-level folder (My Music\artist\album) is regarded by iTunes Preparation as level 0 (this is just FYI, and will make sense if you intend to modify the source code yourself).
  • The first-level folder name (My Music\artist\album) will be used to update the name of the artist for all MP3 files in that artist’s folder (and albums below that).
  • The second-level folder name (My Music\artist\album) will be used to update the album for all MP3 files in that album’s folder.
  • iTunes Preparation will not dig any deeper than the second-level.
  • The name of the first text file found in the first-level folder (artist) will be used (minus the extension) to update the genre.
  • If an MP3 file contains both an ID3 v1 and ID3 v2.3 set of tags, the v1 set are removed and the v2.3 set are retained/updated.
  • If an MP3 file contains no ID3 tags whatsoever, the file is ignored.
  • iTunes Preparation does not add any junk data to your MP3 files, such as “edited with iTunes Preparation” or anything unwanted.

To demonstrate what difference the album field makes (and to understand one of the major reasons I created iTunes Preparation in the first place), consider these two screen captures of iTunes:

(Picture: before specifying MP3 album field)

Before: the first movements of each performance of Beethoven’s 5th are listed together, then the second movements, etc. It’s not easy to tell them apart.

(Picture: after specifying MP3 album field)

After: each recording of Beethoven’s 5th now is easily distinguishable; I can listen to Klemperer’s recording, then Zinman’s, without jumping back and forth between them both.

Before tidying up my MP3 collection, iTunes listed one category (Classical), a bunch of composers with names in various formats, and, the greatest sin of all, each recording of a symphony would show the first movements together, then the seconds, thirds, and fourths. It wasn’t easy to listen just to Klemperer’s recording, for example. I had to either drag each movement into a special playlist, or just put up with it. After running iTunes Preparation over my collection, iTunes now displays a music library that doesn’t make me think unhappy thoughts, which is a good thing.

To run iTunes Preparation:

  • Make sure you have the Microsoft .NET Framework Version 2.0 installed. If you’re not sure, you could try skipping this step, but, if it doesn’t work, you’ll have to install the .NET Framework.
  • Download, unzip, and run “iTunesPreparation.exe” which is contained in the file.

To modify iTunes Preparation:

Feel free to leave any comments/success stories below. There is absolutely no warranty for iTunes Preparation. I created it to suit my own needs, and get the feeling that it may prove useful to others as well (particularly those with a large classical music collection). Before running it, I suggest you make sure that your music library is backed up and that you also perform a dry-run on a small selection of your library copied to a different folder.

By the way, if your music collection already has been added to iTunes, you’ll probably need to remove them from iTunes, run iTunes Preparation, then re-add the folder containing your music library. Good luck.

8 thoughts on “iTunes Preparation

  1. Ouch! I know some people that are so in love with Microsoft’s products that they would take great delight at being in your situation. I don’t care much for Linux any more but I’m not so sure I’m ready to lube-up for Bill just yet :-)

  2. Tooling around by hand… isn’t that the only way to tool around? All space fillers are welcome, and yes, this Jolyon dude is a former employee of your former employer.

    I added my two cents worth to your blog but it appears as a comment from “(no name)” because Windows Live hates me or something… I even tried adding a profile ( but it now says that I have to request permission to view my Live Space, even though I’m logged in as me). Who did you have to bribe at Microsoft to get through?

  3. *Gasp* You actually wrote something in a M$ language? Damn, what happened to you China, you used to be cool… Seriously though, I’m sure someone will make use of this handy little util. Personally, I make sure I rip my CD’s with something that supports CDDB, or just download a compilation that someone prepared earlier (only if I own a copy of the material I am downloading of course…) Thusly, I dont have to do any of that tooling around by hand. I’m sure you want to hear all about how I do things too, meh, just consider the last two sentances as space fillers.

    Now, this Jolyon dude that commented previous, he was from Tamworth right? Did he ever work for those dodgey buggers at CPS like me? Shout out to you dude if you are said person, part of my past I wish I could forget as well… :-D

  4. Hey Jolyon, long time no see/hear :) I must admit to never even considering the LAME command-line option. This year I’ve switched from Java Servlets to ASP.NET (C#) for my uni major project so I needed some practice with Visual Studio.

    Recently I used a FOR statement to convert a bunch of images using ImageMagick, which is much easier than trying to sift through the internet’s large collection of really crappy (spyware riddled?) programs for doing the same. But, can a FOR statement recursively process subdirectories, read a value in a TXT file, and use different switches for different levels, all in one statement? I’d bet you could do that with BASH in Linux, but I’m not sure Windows’ command prompt is quite up to the task :)

  5. Did you know that you can use LAME on the command prompt in combination with the FOR command to recursively go through your collection to edit and rename your tags?

    I don’t use iTunes although I appreciated having AAC file with MP4 wrappers. I’ve converted all odd 600+ CD’s of mine to M4A. My sympathy with iTunes…

  6. Thanks for your comment. I did know how to do that in iTunes but after ripping my 300+ CD collection to MP3 that would have meant an awful lot of copying and pasting and clicking in general. It took less time to write iTunes Preparation than the time I calculated it would have taken to do it by hand. Hopefully iTunes Preparation might one day save some other poor soul with a large music collection :-)

  7. Did you know that you can edit the ID3 tag info for multiple songs simultaneously in iTunes itself? It will automatically move songs around to their correct place in your iTunes Music folder based on what ID3 info you give them in iTunes. Don’t know whether that would have solved your particular iTunes issues but thought I’d mention it.

Leave a Reply

Your email address will not be published. Required fields are marked *