iTunes AppleScripts to Clean TV Episode Metadata

This post was published more than a few years ago (on 2010-08-25) and may contain inaccurate technical information, outmoded thoughts, or cringe takes. Proceed at your own risk.

This weekend, I dumped a bunch of TV episodes I ripped from DVDs into iTunes, and faced a daunting task to clean up all of the titles and other metadata. Thankfully, iTunes has a special […]

At this point, I'm not sure what happened, but it seems the rest of this paragraph got lost when I moved blog hosts. Kept the rest, because most of it makes sense, but caveat lector.

Put Track Prefix to Track Number

If your tracks are named something like 22 - The Gift, this script will grab the prefix number and copy it to the Track Number field.

Remove n Characters From Front or Back

Once you've copied the prefix to the Track Number, clean up that name with this script that lets you strip any number of characters from the beginning (or the end) of the track name.

Track Name Edit with sed

If you need to do a complicated find-and-replace, or anything else sed can do, this script will take the track name and run whatever sed command you type into it. If you need a primer on sed and regex, check out those links. Note, though, that sed doesn't support extended regex.

If that wasn't enough, I created some of my own:

Clean Ripped TV Episodes

The first one I wrote this weekend cleans up the metadata so they will sort and preview correctly on both iTunes/tv (which sort by Episode Number) and iPad/iPhone/iPod (which sort by Track Number). If you only want to go one way or the other, check out Copy Track Number to Episode Number or Copy Episode Number to Track Number.

Track Name Clean Parts

…and the second one, that cleans up Part n signifiers at the end of a title, even the messy ones.

Proper English Title Caps 2

Cleans up the capitalization of the titles or other metadata in the track. I made this one a while back, updated from an existing script that didn't handle a number of special cases. Needs to be updated to include better handling of capitalization after delimiters, but otherwise works pretty okay.