« iTunes AppleScripts to Clean TV Episode Metadata »
Tue, 24 Aug 2010 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 Scripts folder that allows you to easily run AppleScripts on your selected tracks, or even your full library. Here’s a few that kept me sane this weekend:
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 Episode Number to Track Number or Copy Track Number to Episode 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.

Reader Comments