Part 1: (Tutorial) Automating DVD Backup with FairMount, HandBrake and iTunes

Discussion in 'Apple TV and Home Theater' started by mac.jedi, Nov 14, 2008.

  1. mac.jedi macrumors 6502

    Feb 1, 2008
    The O.C.

    Part 1: 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


    Backing up a DVD library can be an arduous, time consuming task. Using a GUI tool is a simple task if you do one occasionally, but a lot of us have been collecting DVD’s for over a decade and have amassed large collections that would take days, weeks, months or even years to complete.

    In addition, if you’ve ever tried to encode an entire season of TV episodes you know how laborious a project this can be as well: Insert a disk, rip the disk, choose your encode settings, select and add each title to the queue, process the file, rinse and repeat for each of the disks in the season.

    The good news is that most of these tasks can be easily scripted to remove the manual intervention required. You could rip and encode an entire series very easily with the help of automation. Just insert a disk and it will rip automatically. When done, pop in another. If you’ve got Mac Pro with dual DVD drives, pop in two and you’ll save yourself a trip. Set an iCal alarm, and at midnight HandBrakeCLI will encode each title over 20 minutes long to a universally compatible format. All you need to do now is the tagging, and you can script some that as well. You can even enable a folder action that would add the finished files to an iTunes Library on a remote mac mini. Virtually anything is possible with automation.

    This tutorial follows the recommended approach of ripping your DVD media into VIDEO_TS files located on your hard drive. Then, encoding them to an iTunes compatible MP4 format. Next, tagging the files with metadata iTunes, FrontRow, AppleTV or other devices can manage. The workflow is broken up into components that can be used individually or together to create one simple batch workflow.


    Workflow Components

    • Batch Ripping with FairMount
    • Batch Encoding with HandBrakeCLI
    • Scripting TV Episode File Renaming for Automatic Tagging
    • Folder Actions for Adding to iTunes Libraries with Automatic Tagging

    Managing Your Workflow Files

    A well planned folder structure will make your workflow much easier to manage. Most of these scripts rely on consistent paths to the source and destination folders, as well as the scripts themselves. For most users, your files should be processed on your local hard disk. External drives can be used, but in some cases they may slow down the speed of your encoding.

    For these tutorials, we'll use your ~/Movies folder as the container for our workflow files and folders. Keeping your workflow under this one directory will make this process much easier. You can then move your finished rips and encoded files to another drive after they are done.

    Creating Your Batch Folders

    1. Navigate to your ~/Movies folder.
    2. Create a New Folder and rename it BatchScripts. This folder will help keep your batch scripts organized and easy to access if called from another script.
    3. On first run, the BatchRip.scpt will create a folder named BatchRip. This folder will be used as the destination folder for your Video_TS files when copied from DVDs. This folder will also be the source folder for HandBrakeCLI.
    4. On first run, the BatchEncode.scpt will create a folder named BatchEncode. This folder will be the destination folder for your MP4/M4v files encoded with HandBrakeCLI.

    About Growl Support

    Growl v1.1.4
    Growl is a free notification system for Mac OS X: it allows applications and scripts that support Growl to send you notifications.

    The BatchRip and BatchEncode scripts both contain Growl support. The GrowlNotifyLib.scpt below is needed by these scripts to notify the Growl application. The script contains notifications for Display, Email and Speech, but only Display is enabled by default. To activate notification by email or speech, navigate to the Growl System Preferences and click enable in the script's application notification settings.

    1. First, Download and Install Growl. Then RESTART your system.
    2. Select, Copy and Paste the GrowlNotifyLib script into a new Script Editor document.

      -- Growl Notify Script Library
      -- Setup Growl Notification: Adds script to Growl's application list 
      on setGrowl(growlTitle)
      	tell application "GrowlHelperApp"
      		set the allNotificationsList to ¬
      			{growlTitle & " Notification", growlTitle & " Email", growlTitle & " Speech"}
      		set the enabledNotificationsList to ¬
      			{growlTitle & " Notification"}
      		register as application ¬
      			growlTitle all notifications allNotificationsList ¬
      			default notifications enabledNotificationsList ¬
      			icon of application "Script Editor"
      	end tell
      end setGrowl
      -- Tells Growl to notify you when script is completed
      on growlMe(growlTitle, growlMessage)
      	tell application "GrowlHelperApp"
      		notify with name ¬
      			growlTitle & " Notification" title ¬
      			growlTitle & " Notification" description ¬
      			growlMessage application name growlTitle
      		notify with name ¬
      			growlTitle & " Email" title ¬
      			growlTitle & " Email" description ¬
      			growlMessage application name growlTitle
      		notify with name ¬
      			growlTitle & " Speech" title ¬
      			growlTitle & " Speech" description ¬
      			growlMessage application name growlTitle
      	end tell
      end growlMe
      ----------  End Script ----------
    3. Save the script in your "~/Movies/BatchScripts" folder as "GrowlNotifyLib.scpt"

    Go To Part 2: Using AppleScript to Automate Ripping
  2. mac.jedi thread starter macrumors 6502

    Feb 1, 2008
    The O.C.
    ANNOUNCEMENT: Tutorial & Scripts Updated!

    The tutorial instructions and scripts have been updated to make them more plug and play.

    • Scripts have been rewritten to make them much easier to setup. My hope is that most users will not have to modify the scripts at all.
    • Scripts now include defaults that should run on any system. Default locations for files and scripts have been set to the ~/Movies/ directory.
    • BatchRip and BatchEncode Folders are now automatically created in your ~/Movies/ folder.
    • Growl Nofity Code has been moved to a script library that is loaded when called. You can now easily enable it in your batch script's properties.
    • BatchRip now auto-checks if two disks are loaded, no dual-drive setup required.
    • BatchRip now includes an auto-eject yes/no property.
    • BatchRip will now growl the disk name(s) when completed. Great for email notification.
    • shell script has been updated & posted. No additional setup should be needed.
    • BatchEncode now uses HandBrake's Universal preset by default.
    • BatchEncode now includes easier setup for encoding two batch folders at the same time.
    • BatchEncode now has a file type property to easily change output container. Default has been set to .m4v.

    That might be it. Will edit if I think of anything else. Thx.
  3. mac.jedi thread starter macrumors 6502

    Feb 1, 2008
    The O.C.

Share This Page