Wednesday, 21 April 2010

Music library consolidation

A year or 2 ago I became so annoyed with the quality of our music collection that I started over, re-ripping all music that I cd's on hand for. But this meant that I didn't have all our music: lost cd's, cd's from my folks, etc. So lately I've been migrating some of this music back in.

The steps went along the following lines:
1) sync the files on to my local drive.

2) wrote a small app that made a hash of the files, and removed files that had an identical hash so that I wouldn't have to deal with duplicates

3) clean up the tags so I used MusicBrainz's Picard app to bulk fix the tags.

4) Then the trouble of having something that would read the tags from the files. Ideally I wanted iTunes to do this to make comparisons easy. After a while I figured out that if you launch iTunes using option click (on mac, shift click in windows), it will allow you to start it with a different library. That created the xml library file.

5) the format of the xml library file is kind of stupid as xml goes so that makes parsing harder than normal. Luckily I was able to find an example where they parse the file in java.

6) wrote more code that plays "which files are missing" and using blacklists (don't import this) and whitelists, I started to get files that I want to move.

7) I looked into calling iTunes programmatically to import the files, but that started to look like a no-go. So with a little help from commons-io to copy the files I wanted to a specific directory and then I got iTunes to import that directory.

There is still a bit more work, but that was the basic steps.

No comments:

Post a Comment