A Sinatra app and collection of Ruby scripts to help organise your downloaded and ripped DVD collection
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
public/stylesheets
toolkit
views
README.textile
ripperhud.rb

README.textile

RipperHUD and related tools

This toolkit and mini-Sinatra app are a collection of scripts and utilities I’ve put together to improve/automate my DVD ripping workflow as much as possible. The aim is to get encoded DVD rips and downloaded movies/tv shows organised and added to the Plex media library as easily as possible.

NOTE: All of this is quite specific to my individual needs; I’m publishing it as it may be useful to somebody else. The best way of using this is to fork it and modify to your hearts content. I welcome any push requests that add useful generic functionality but don’t be offended if I don’t respond to all of them.

Other tools that I use as part of this process are:

  • taskspooler, a Unix command-line utility for queuing commands,
  • media-mover, a Perl script for sorting TV shows and movies,
  • RipIt, a simple DVD extraction tool,
  • Handbrake, specifically the CLI version but sometimes the GUI for manual jobs,
  • Transmission, a cross-platform BitTorrent client,
  • TVShows, an RSS torrent downloader, project seems to be dead though.

Hardware setup

I use a Mac Mini as my media server. The plan is to install Plex on this machine and hook it up to my home entertainment system (i.e my AV receiver) using a mini TOS-link cable for audio and a DVI to HDMI cable for video. All external storage for media is attached to this machine and this is the only machine I have running permanently (it also serves as a music server for my Squeezebox devices).

Processing downloads

This is the simplest part. I get new torrents on to my Mac Mini several different ways; I keep Transmission running on the Mac Mini monitoring my Downloads folder for new torrent files. I also run the TVShows daemon to assist with downloading of torrents for new episodes. On my primary machine (my MacBook), I run Hazel, having it monitor my Macbook’s downloads folder for any torrents, which are transferred over to the Mac Mini Downloads folder for processing automatically.

All completed downloads are moved into a “Completed” folder by Transmission, ready to be organised. A simple Ruby script called “downloadmonitor” moves any movie files from this “Completed” folder to a “New Movies” folder ready to be organised.

Processing DVD rips

Running RipIt, I can continue to replace DVDs and they are automatically ripped as *.dvdmedia files. Once they are ripped, they need to be processed and individual tracks encoded using a combination of HandBrakeCLI, my custom ripper script and the RipperHUD Sinatra app. This process is explained in more detail below. Encoded movies are moved to the “New Movies” folder, ready to be organised.

Processing “New” movies

The media-mover script is configured using launchd to monitor new files in the “New Movies” folder. If the file looks like a TV show (e.g. “Some.Show.SxxExx.avi”), media-mover will create folders for the show name and season in a specified location and move the file there. It will optionally inform the Plex media server of the new file. Example:

The.Wire.S01E03.releasegroup.avi > The Wire/Season 1/The.Wire.S01.E03.avi

Other files are assumed to be films and are moved to another specified location. Again, media-mover can be configured to inform Plex of the new media.

Processing DVD rips in more detail

Most of the end-to-end process for DVD rips and downloads is now automated. A torrent for a new episode of your favorite TV show can be downloaded, detected by Transmission, downloaded, sorted and added to Plex all without any user intervention.

Most of the DVD ripping process can be automated too but there is one step that requires some manual intervention — that is, aside from the need to constantly feed your ripping station new DVDs, you need to analyse the DVD images to detect which of the many tracks is an “episode” and which episode it relates to.

The ‘ripper’ utility

This is where my custom “ripper” script comes in. It is essentially a wrapper around HandBrakeCLI with some pre-configured encoding settings for TV shows, animated TV shows and films. However its main utility is to take a given DVD rip, a show name and a range of episodes and analyse a DVD image for the tracks that are most likely to be the episode tracks. It then enqueus a HandBrakeCLI command for each episode using taskspooler. This makes it really easy to build up a queue of encodes for each ripped DVD without having to manually analyse each one using the HandBrake CLI or GUI. This is best illustrated with an example:

$ ripper -i familyguy1disc1.dvdmedia -n tv_anim -name “Family Guy” —episode-range 1..4 —season 1 —episode-duration 22

The above command will take the given dvdmedia DVD image and analyse it for all tracks that have a duration of 22 minutes (and by default, give or take 2 minutes). If it finds enough tracks to cover the range of episode numbers given (in this case episodes 1 to 4 or season 1), it will enqueue a HandBrakeCLI command for each track using each episode number in the range given. Using the TV show name and season given, the eventual output will be the files:

  • Family.Guy.S01E01.m4v
  • Family.Guy.S01E02.m4v
  • Family.Guy.S01E03.m4v
  • Family.Guy.S01E04.m4v

These will be moved to a specified folder (this should be set to the “new movies” folder) where they are ready to be organised.

Because the script uses taskspooler, you can process as many DVD images as you like and an encode for each episode will be queued up.

There are a few advanced options; you can specify the duration variance if episode durations tend to differ by more than the default 2 minutes either way.

You can also specify a track offset if you want to ignore the first X tracks on a DVD that look like episodes (useful if you have episodes from multiple seasons on a disc that need to be processed separately). For instance, if a disc has episodes 9 and 10 of season 2 and episodes 1 and 2 of season 3, you could do something like this:

$ ripper -i someimage.dvdmedia -n tv -name “Some Show” —episode-range 9..10 —season 2 —episode-duration 22 $ ripper -i someimage.dvdmedia -n tv -name “Some Show” —episode-range 1..2 —season 3 —episode-duration 22 —track-offset 2

The HandBrakeCLI commands are configured to use the built-in HandBrake encoding presets that I’ve found to be best for my needs; you may want to customise these. There isn’t currently a way of specifying additional encoding parameters using ripper from the command-line; please feel free to fork and add this stuff.

RipperHUD

This is a small, simple Sinatra application that can be run from any machine on your network. It reads a folder on your ripping station for new dvdmedia files and presents a web-based UI for queuing up ‘ripper’ commands for each one. A screenshot can be found here.

It should be pretty self-explanatory. You can run the app from the command line:

$ ruby ripperhud.rb

This will start up a web server on port 4567. You will currently need to modify the script itself to tell it the IP address of your ripping station machine, the user and which folder to monitor. It will establish an SSH connection to the machine to run remote commands. There isn’t any support for password-based authentication so make sure you set up some SSH keys. It also uses taskspooler to enqueue the ‘ripper’ commands with a high priority meaning they will always be the next task to be run.