Announcement
I've posted a new tutorial thread in the Apple TV and Home Theater forum:
How-To: Automating DVD & Blu-Ray (Backup, Encoding & Tagging) for Mac OS X 10.6
I hoping this one will die a graceful death.![]()
Enjoy!
Part 4: Automating DVD Backup with FairMount, HandBrake and iTunes
Parts to this tutorial:
Part 1: Introduction
Part 2: Using AppleScript to Automate Ripping
Part 3: Using a Batch Script to Automate HandBrake
Part 4: TV Show Renamer Droplet
Part 5: Add to iTunes and Auto-tag Script
TV Show Renamer Droplet
This script gets data from a plain text file you've named: show name_season#.txt (example: The Office_01.txt). This text file should contain only the episode names (one on each paragraph line) for this season only. This droplet will rename a sequential series of m4v files dropped on to it, so it is important your files are already named in order, they are usually already in order by the title number. The script will parse the file name and contents of the plain text file and rename the video files with the following file naming convention: Season#_Episode#(sequential)_Show Name_Episode Title.ext. The companion "Add to iTunes and auto-tag" script will parse these file names and insert the correct meta data automatically upon import to iTunes. You must save this file as an application in Script Editor in order to run the script when files are dropped on to it.
Creating Your TV Show Renamer Droplet:
- Create a plain text file for each season you've encoded and want to rename.
a. Copy and paste an entire season of episode names into a txt file (one on each paragraph line). Only include the episode name.
b. Save this as a plain text file and name it with the show name and season number (season three as shown in the following example): Show Name_03.txt
- Create the droplet
- Select, copy and paste the script below into a new Script Editor document.
Code:-- TV SHOW RENAMER SCRIPT (* This script gets data from a plain text file you've named: show name_season#.txt (example: The Office_01.txt). This text file should contain only the episode names (one on each paragraph line) for this season only. This droplet will rename a sequential series of m4v files dropped on to it, so it is important your files are already named in order, they are usually already in order by the title number. The script will parse the file name and contents of the plain text file and rename the video files with the following file naming convention: Season#_Episode#(sequential)_Show Name_Episode Title.ext. The companion "Add to iTunes and auto-tag" script will parse these file names and insert the correct meta data automatically upon import to iTunes. You must save this file as an application in Script Editor in order to run the script when files are dropped on to it. *) on open dropped_items -- If you want to go directly to a certain folder every time, change the "default location alias" to the path to your episode list folder ("Macintosh HD:Users:Your Name:Documents:Episode Lists:) set textInfo to choose file default location alias "Macintosh HD:Users:" with prompt "Choose file which contains the title list" without invisibles set titleList to paragraphs of (read textInfo) tell application "Finder" to set {name:txNm, name extension:txEx} to info for textInfo set AppleScript's text item delimiters to "_" set txNm to text 1 thru ((count txNm) - (count txEx) - 1) of txNm set showInfo to every text item of txNm set txEx to "." & txEx set AppleScript's text item delimiters to "" set idx to 1 repeat with i from 1 to count dropped_items set {name:Nm, name extension:Ex} to info for (item i of dropped_items) as alias if Ex is missing value then set Ex to "" if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm set Ex to "." & Ex end if tell application "Finder" to set name of item i of dropped_items to item 2 of showInfo & "_" & text -2 thru -1 of ("00" & (idx as string)) & "_" & item 1 of showInfo & "_" & item i of titleList & Ex set idx to idx + 1 end repeat end open
Optional: Change the default location path to the path to your "Episode Lists" folder if you'd like the prompt to automatically open to that folder.
- Save the script as an application: Choose File > Save As... > select Application from the File Format popup menu.
- Verify that no options are checked.
- Click Save.
- Select, copy and paste the script below into a new Script Editor document.
- Rename your episode files
- Select the files you want to rename. Note: It is important your files are already named in order, they are usually already in order by the title number.
- Drag and drop the selected files onto the TV Show Renamer droplet.
- Navigate and select the text file you created in Step 1 from the dialog box.
- The episodes should automatically be renamed with the following file naming convention: Season#_Episode#(sequential)_Show Name_Episode Title.ext
Go To Part 5: Add to iTunes and Auto-tag Script