Thursday, April 7, 2011

Relocating Your iTunes Library

If you're like me, then you find the way iTunes attempts to abstract away your music collection extremely annoying. In particular, I do not care to let iTunes manage my music folder since I already have it quite well managed, thank you very much. I also find "music/Arcade Fire/Neon Bible/Black Mirror.mp3" to be a tad more 'intuitive' than whatever series of hash values, whistles and clicks iTunes uses. Of course, this can be a problem if you ever decide to *move* your music collection, as the iTunes library metadata is, unsurprisingly, not human readable and has hard-coded paths to your music files.

A few folks did some research on how to get around this, and came up with an excellent plan, as detailed here and here. I gave this a whirl on my wife's library and it worked a charm. I was moving files from "D:\music" to "H:\MEDIA\music" so used the command:
sed -i -e "s|D:/music|H:/MEDIA/music|g" "iTunes Music Library.xml"

What happened next is why I despise computers. After using this method to move my wife's music, and having it work perfectly, I did the EXACT SAME PROCESS on my library and it failed miserably! On startup, instead of being apologetic "Oh, your library is corrupt... so sorry, please let me rebuild it..." iTunes just curtly goes "Hmm... Your library looks wonky. Let me ERASE IT."

Luckily, the folks at Apple put more of their "intuitiveness" into the product, and there is an easier way. If you just load iTunes up with the old library data, you'll likely get an iTunes display with lots of (!) icons indicating your file is missing. If you double-click on one of these, it will inform you it's missing and give you the choice to locate it on disk. When you do locate it on disk, you will *then* be given the option to find other files based upon this first one.

The process takes a ludicrously long time, since iTunes figures merely rewriting its library a few thousand times isn't enough work, so it decides to download album art and analyse gapless playback info all at the same time, bringing my i7 laptop w/ 4GB of RAM to its knees. Eventually, though, your library will be relocated in the mind of iTunes and you can continue cursing it as per usual.

No comments:

Post a Comment