Ever since Apple launched iTunes Match late last year, it’s been great for being able to have a copy of your music available everywhere, on your iPhone, computer and your Apple TV. One of the best features for me is being able to ‘match’ music I’ve ripped from elsewhere. This is great for lots of older stuff I ripped from CDs at a much lower bitrate (128kbps MP3).
What Match doesn’t do however, is ‘fix’ metadata. When you import a CD, usually you’re able to match it with CDDB so you get the track titles and artists for that CD without manually adding them. But this (usually) doesn’t work with custom/obscure CDs, such as a mixtape from a friend. And you could’ve been lazy and went easy on the tags, not filling out the artist correctly.
It’d be great if Match could offer to fix track metadata, afterall, it knows the music is available in the iTunes Store!
Fortunately, there’s a few ways to fix that, and it doesn’t take too long… (If you’re on a PC, head towards the bottom of the post)
For this blog post, I’ll be using a ruby script created by @tapbot_paul, which I’ve tweaked myself to favour song results from the AU iTunes Store first (being myself based in AU).
You can download it here.
Before continuing, please make a backup of your music library – I’d hate for it to ruin your library, nuke your computer… and I’m not responsible!
Every song in iTunes has its own unique ID – this allows you to create a direct link to the song, and can be used by Ping etc to make sure you ‘like’ the right song from the right album. Usually only songs purchased from iTunes have this ID inside them; luckily, music downloaded from iTunes Match (that is, those with a kind of ‘Matched AAC audio file’) actually do have this ID inside them.
If your music isn’t a Matched AAC audio file, ensure that the song has an iCloud status of ‘Matched’, then proceed to delete the song from your computer (not from iCloud), then redownload it again.
Apple also provide an API for developers to look up song metadata using the iTunes song ID – perfect!
To sum up, this will only work for music matched with iTunes, and has a ‘kind’ of ‘Matched AAC audio file’.
For this blog post, I’m going to be looking at a small collection of music ripped from a CD and incorrectly tagged. (yes, laugh at my taste all you want)
First up, we’re going to require a few things to get this script working.
Fire up Terminal and paste in the following (you will require XCode (free) from the App Store if you haven’t already installed it)
(As Appleman has commented, you might also need to install the command line tools: Go to Xcode -> Preferences -> Downloads tab then install the “Command Line Tools.” )
sudo gem install jsonsudo gem install rb-appscript
You also need to put tunes.rb into your iTunes folder. Open up Finder, open the Go menu, and choose ‘Go to Folder‘.
Now you’re all ready to start. Put the iTunesMatchMetadata.rb script on your desktop – this will make it easy to launch and run.
Open up iTunes and select the songs you wish to match. (make sure that their kind is ‘Matched AAC audio file’ – if they’re not, ensure that their iCloud status is ‘Matched’ and then delete and redownload the matched version)
If you haven’t selected any songs and run the script, it will scan all songs in your library
Back in Terminal, swap to your desktop;
And now we can launch the metadata script!
Assuming you did select songs in iTunes, the script will look for songs with a kind of ‘Matched AAC’ and look for IDs, before querying a whole range of iTunes Stores. When songs are found, the metadata is simply overwritten into the songs.
Occasionally you will get songs, that, even though they have been matched, simply don’t exist in any of the iTunes Stores. Unfortunately this is a known issue. However it will try its best to query many different iTunes Stores looking for a ‘match’. (ha)
Once it’s finished and you’re back to your
you’re done! Check iTunes for your freshly ‘fixed’ metadata.
If you’re not on OS X, or the thought of Ruby and the Terminal frightens you, there are other tools available. I haven’t tested and therefore cannot vouch for their success/failure, but you’re welcome to try and comment here!
Mac OS X: iTunes Match Helper
Let me know how you get on and leave a comment with your 2¢!