I'm not knowledgeable about scripting, so I'll be upfront about that. I've been doing management with Doug's Scripts for over a decade, but the one that would be most useful (Append to Selected Tag) doesn't offer the correct fields to adjust the information I want to change.
I would like to prepend the season number and the (padded 2 digit) episode number to the beginning of episode names in my library (not the file name!), so I get something like 101 Pilot, 102 Deep Throat, 103 Squeeze, etc., in my smart playlists for using on AppleTV (because the newer AppleTVs running tvOS do not show that additional information in the playlist view, and it's easy to lose your place in long running series).
I have used Subler and iFlicks, and both can handle prepending the information and adding to iTunes going forward, but if I drop my older library files to those apps, some of my comments, groupings, etc., get erased using their update metadata options (in iFlicks 2, the artwork also gets changed, and I have to handle each season separately to change it back), and neither handle extended episodes or DVD vs Aired orderings well when starting from a clean slate.
I'm looking for a script that I can use to select entire playlists or shows and only changes the one tag (the episode name) using info from other tags that I already have populated (the original episode name, season number, and episode number) and that can pad the episode number 0-9 to 2 digits. Can someone point me in the right direction?
Best Answer
I think this will do it for you:
The script could be cleaned up and made more efficient but I wrote it this way so it was easier to follow.
Be sure to select the shows, not the playlist. It doesn't work otherwise.
While experimenting with this I noticed that some TV shows have episode numbers that are three digits already. That would be a problem for this script. FYI.
This was done with iTunes 12.9.5.5, macOS Mojave 10.14.6.
Here are before and after pictures. You're going to have to zoom in.