Sunday, September 12, 2010

iTunes burns mp3 files to disc

This is a post about OS X, with a bit about Python, sorry but no Bioinformatics.

Recently, I got seduced by the iTunes Store. I have refused to buy any music through Apple before now, but since the DRM is gone, I thought why not? And as I'm sure you know, searching the store and downloading for instant aural gratification is fun. I worked through the Rolling Stone magazine top 500 (not all!), and various movie soundtracks, etc.

I also misplaced my iPod Shuffle, and though I have a new one on order, I decided that I'd like to burn a playlist to a CD to listen in the car, and importantly, that it would be in mp3 format so I could put 100 songs on a single disc. The default is to recode from AAC to AIFF before burning, which from an informational point of view is just silly, and obviously limits the capacity.

Having learned that GIYF, I searched out the relevant advice on the internets. With a song (or an entire playlist) selected, just do: Advanced > Create MP3 Version

It's kind of awkward, but this menu item is only enabled if your import encoder method (in Preferences > General > Import Settings...) is set to MP3 Encoder.

Be sure to change it back when you're done---my default is AAC. (I used to use AIFF but with all the music that's just a heck of a lot of storage. And honestly, I can't hear very much difference in quality. Maybe with better speakers...) Another weird thing is that the new versions are only saved (automatically) to the Music (i.e. Library) playlist, giving duplicate titles of different file types.

Luckily, under View > View Options... you can add a column for the kind of file, and then sort on it. This setting is playlist-specific, which is more flexible I guess, but it would be nice to be able to change them all at once.

So I did that and then made a new playlist with all the mp3 files, and subsequently burned that to a disc. It works great, although the song titles don't show on the player in the car, and I'm not sure how to get that to happen.

So now I have one final problem. I really don't want these mp3 files cluttering up my library---they're duplicates, after all. I can select them (still sorted) and delete en masse, but there's a small catch. A few mp3 files that I got from friends as mp3 files, also sort with the new ones, and I don't want to delete them.

Another solution is to use Python. The actual music files are in nested folders like: iTunes Music/Artist/Album/song.mp3.

It's simple to use Python to look through all the files and delete mp3 versions only if they are duplicates. But this still leaves the duplicated titles listed in the library to be deleted by hand.

On reaching this point, I gave up and selected the list of mp3 files in Library, then looked for the special ones, deselecting them with command click, and finally deleted. It seems like what we really need is a way to get Python and iTunes together, and that'll be the subject of a future post. If you're anxious, you can take a peek at this page, which helped me a lot. And of course, you'll need appscript.