Tools for iTunes Libraries


I use iTunes on Windows to manage my music. That’s not an endorsement. iTunes is lock-in. It limits my options, but I like the features. It’s a compromise. There are very good reasons for not using it (“I loved iTunes until my iTunes database got corrupted”), but it’s been good enough for me. I can get at most of my data through a series of semi-public formats and documented APIs, and being saved the trouble of thinking about how to manage music is a feature in itself.

Then, I ran into a specific task - moving files from one drive to another, without losing any metadata. Doesn’t seem like it does that unless I let it choose where everything is stored. Now, I could throw away my metadata and start again, but that would be a shame. You can move tracks individually but that’s not really practical. Rebuilding from the XML version of the library throws a lot away. The COM API doesn’t expose file location as a writeable property.

The next option was to change the binary library myself. My starting point was brian d foy’s great documentation as part of the Mac::iTunes perl module. So the challenge was really whether I could figure out how to make the change before I resented iTunes enough to install something else.

It’s all checked in if you’d like to take a look (Java). I used the MoveMusic tool to make the change and it all seems to have worked. There are test cases in there, and the start of a more comprehensive data extractor. It’s all source. I can see a downside to productising something that will almost certainly break future versions of the library. (This was developed against 8.0.1.)

Some new features in iTunes appear to have their configuration in SQLite databases, which is a nice trend. (Closer look: SQL error: file is encrypted or is not a database. Oh, okay.)

(Music: Queens of the Stone Age, “3’s and 7’s”)
(More from this year, or the front page? [K])