Tag: Applescript

UPDATE: TV.com (which I use to find the show titles) has since changed their format, so I cannot guarantee that this script works as advertised. I will confirm it in the near future.
UPDATE 2: This Applescript has been replaced by a more efficient and lightweight Bash script.

After picking up a 750 GB hard drive for my Airport Extreme, I’ve started to rip my DVDs so that I can watch them on my computer. The problem is that the files don’t come out with descriptive episode titles, leaving you guessing when you want to pick a show to watch. If you decide to add the titles yourself, the process can be tedious and time consuming, not to mention downright annoying.

That is why I’ve created a combination Automator/Applescript workflow to do the job automatically. After entering the name of the TV show you’re looking for, the program takes the selected files and searches TV.com’s vast episode guide for the correct titles. Once the data has been collected, the titles are added to the selected files. The only preparation you must do is rename the files in the format SxxExx where S is the season number, and E is the episode number (S02E05, for example). This step is very easy when you use a program like NameMangler, which can add sequential filenames in one pass.

Download

Get TV Titles Application Download and run as standard application
Get TV Titles Workflow Automator workflow that can be saved as an application or Finder plugin
Get TV Titles Finder Plugin Can be run from the Finder contextual menu (right-click). To install, download and save to the folder Userfolder/Workflows/Applications/Finder.

Instructions

  1. Collect files and rename them in the SxxExx format. Using NameMangler seems to work best, but there are other applications out there to do the same thing.
  2. Select all the files you wish to add titles to.
  3. Start the program in whichever way you’ve downloaded: directly from Automator, the standalone application, or by the contextual right-click menu and navigating to More > Automator > Get TV Titles.
  4. Type in the name of the TV show you’re looking for episodes from.
  5. If you’re running it via the contextual menu, you’ll see this status message in the Finder menubar.
  6. Once the computer has processed the data, you’ll see all the episodes neatly named.

So far I’ve been able to edit more than 20 files at once. Of course, your mileage may vary, so please comment with feedback and results.

Tagged with: , , ,

I’ve been frustrated recently because external hard drives connected to my MacBook have refused to unmount. After resorting to restarting before trying again, I posted my problem to a number of online forums.

Knowledgeable member of the Macworld forums oddlot answered my question with a Unix command called hdiutil that can force eject a drive.

I took this command and wrote a quick Applescript that displays a list of the connected drives and force ejects the one you choose.

I linked this up to a Butler trigger, so now if a drive is uncooperative, I can activate this script with one key combination.

If you wish to use this script as a simple application, copy the code listed into a Script Editor window (found in /Applications/Applescript). You’ll likely not need to change anything, but if your startup disk is anything other than Macintosh HD, you need to change the beginning variable startupDisk. Choose Save As from the File menu and pick Application from the dropdown menu. This will create an application that you can easily double click whenever you need it.

UPDATE: I realized after I posted this that the functionality is broken when the disk contains spaces in the name. The code posted here has been corrected.
[tags]Applescript, Automator, programming[/tags]

Tagged with: , , , , ,