How to replace mp3 files with m4a versions in itunes

itunesitunes-matchm4amp3

A few points before I get into my question/issue:

  1. I am not looking for a way to convert file formats.
  2. The library and all music is located on another Mac on the local network (so it is not indexed by spotlight and no spotlight-based applescript solution will work).
  3. I am not willing to re-rip all the songs in my library, and in many cases I can't anymore anyway as I've let the physical CDs slip into oblivion over the years as I never used them.

Now, For the short version:

We have two different iTunes library files, both stored on the same local network server (another Mac) as the music files themselves. My library and her library are different, but there is a fair amount of song overlap between the two.

I have used iTunes Match to replace about 5,000 of the songs in my library, with 256kb AAC .m4a files rather than the various qualities of .mp3 files I had previously.

Unfortunately this has resulted in a large number of broken file links in her playlists, because the old file reference was .mp3 and the new file is .m4a. iTunes will allow me to manually re-link each file one by one, but cannot automatically find any others.

How can I get her library, to changes its references from the .mp3 files it knows about, to the newer .m4a files, where applicable?

Note that this does not apply to EVERY file in her library, only to those files that overlap between her library and mind, and that were matched by iTunes.

MORE DETAIL FOR THOSE WHO CARE:

I have a library consisting of about 15,000 songs, almost all of which are mp3s of various quality ranging from 96kb to 192kb. I have wanted to de-duplicate this library for some time, as well as increase the quality of the tracks since storage is so much cheaper these days. However the time & effort involved in doing so has been daunting.

Then yesterday I discovered (well, finally signed up for) iTunes Match. After a bit of searching for various "power user" techniques, I found that I was able to reliably de-duplicate my library in a huge and automated way, bringing it down to the current state of about 15,000 items. Not all of these are "music" however, many are audiobooks, podcasts, etc. iTunes Match was able to match up about 5,000 songs, and uploaded a few thousand others.

Now to the problem. My wife has a separate iTunes library file so that she can run iTunes at the same time I do. We don't share all of the same music, but there is a fair amount of overlap. My library is fine as I have re-downloaded all the 5,000 files with 256kb AAC versions from iTunes Match and deleted the old mp3 files. But now my wife's library doesn't reference these same new files.

I can go through her "missing" songs one by one and locate them, but there are thousands of them. The iTunes "find other missing files" feature is useless here, and finds nothing (I think because of the change from mp3 to m4a but I can't be sure).

So the question ultimately is – how can I, in an automated or batch way – get her library to look at the new .m4a versions of the songs, rather than the mp3 versions which are now gone? I don't especially care about the metadata on her library since she doesn't use it, but I want to make sure any changes will not affect my metadata, as I do use it.

I considered editing the library xml file but realized that this won't help, as it's the database itself that would need alteration and the xml is just an output generated from the DB itself.

EDIT: Hopefully my new "short version" is clearer for those who didn't understand what I was asking before.

Best Answer

I dissected the XML file a bit and it turned out to be a XML property list (sort of a XML-based JSON equlivant), so it becomes easier to handle. If the files affected have the same name not counting its extension, some Objective-C can be laid down to change it. Do you have Xcode installed or should I prepackage it for you?