Replacing old and busted music


In the process of moving, I had occasion to find my CD collection (yes, intellectual property fans, I have every single CD that I used to load my iPod with). I decided that it was time to replace the nasty 128kbps CBR MP3 encoded with the zing encoder using a proprietary disk loader (created by me) in 1999. Consider it a 10-year anniversary gift to my music collection...But, how in iTunes do you do this and keep all your counts and playlists?

[Updated 11:18AM, turns out that contrary to what I'd read, Genre dosn't seem to be the same in order to match and will be replaced by the "new" values for the CD]Unfortunately, like many tech people, I didn't RTFM (or even RTFN--net) before I set out to do this task, I just put in the CDs to see if it would work. Based on my technical knowledge of how Gracenote's CDDB works* (believe it or not, that company basically usurped a cloudsourced database in the early 2000's... but I won't get into that...), I was thoroughly disappointed when iTunes didn't present me with a "do you want to replace" dialog as soon as I inserted the CD. Based on it not doing so, I started deleting the old music once I loaded the new music, losing my last played information,etc.

Then I got to the 15th or so disk, and I was prompted to replace the information.... as I originally thought should have happened all along. I clicked yes, and it did the "right thing", updating the track numbers, times, etc and even the album art, but leaving the playcounts and original import date alone.

What was the difference? Well, I did a little googling and found that if the Track Name, Artist, and Album are exactly the same, the imported tracks overwrite with the warning. However, if any of those for any track are out of alignment, then the track will be imported separately.

This made life a lot easier. So, if you make sure that those 4 attributes are correct, you will get a clean re-import with your data preserved.

There are, by the way, 2 ways to do this, you can either change the information in your library to match the imported data, or you can change the imported data to match the library. Once iTunes has downloaded the data from Gracenote,it is available for editing and if you like your previous information, or if it is more correct, then you can just edit the information on the CD.

Here is my workflow, as I've now come to know and love it...for each disks (assumes iTunes is running). Also assumes that you have set your iTunes to "Show CD" in the "When you insert a CD" preference in the General Preferences.

  1. Control-Click the CD in the source window to bring up the context menu, and select Open In A New Window. This requires some screen size or shrunken windows, but it's a lot easier than trying to flip back and forth because the source list clears the search field every time that you change a source.
  2. Click back over to the main iTunes window and select Music in the Source List
  3. Search for the album in your library
  4. Carefully compare the Album, Artist to make sure those match (these are the most important, and can be edited en masse by selecting all tracks and using Get Info to change the whole lot at once)
  5. Look over the track names if they don't match, change either the CD names to match your library or the library names to match your CD
  6. Go back to the CD window and click Import CD
  7. Once the CD is done importing, switch back over to your iTunes Music window and see if there are any duplicate tracks (technically, they'll be near duplicate, since the track names must be different for it not to replace them). To make this process easier, drag over the "Date Added" column, as it will remain the same for replaced tracks and will show today's date for newly imported tracks.
  8. If you are done, do another disk starting at step 1. If you find you have a duplicate track, don't despair. Just delete the NEW one and then fix the track name again.
  9. This time go back over to the CD window and uncheck all the items except the tracks you want to reimport.
  10. Click Import CD again and it should replace the tracks.

Unfortunately, it's not as automatic as I'd hoped, but it is much better than having no way to do it at all.

CDDB Technical Details

I'm not sure if they're using the same algorithm, but the original cloudsourced CDDB used a simple checksum of the # of tracks and the length (in seconds) of each track to figure out which CD was which. There were surprisingly few collisions and if the checksum (used as a hash in this case) collided, you could always check the individual track information. You can see why I expected it to handle this process a bit better... oh, well. live and learn.

Now I must decide if I'm going to restore from backup and redo the ones I overwrote yesterday or whether I'll just work from this new baseline. I'm probably going to do the latter, as this isn't the first time that I've done some replacing this way...