shift_subtitle

My submission for Ruby Challenge #1: Shift Subtitle

rubylearning.com/blog/2009/09/24/rpcfn-shift-subtitle-1

Features

  • 100% RSpec test coverage of both lib/* and bin/*

  • Works in both Ruby 1.8 and 1.9

  • Bundled as a gemcutter gem (thanks to Jeweler)

  • No external gem dependencies to use the gem

  • Command line related code in shift_subtitle_cli.rb and SubRib/SRT processing code in shift_subtitle.rb

  • shift_subtitle.rb uses IO streams (such as File and StringIO) to support processing large files

  • Time shifting handles boundary cases

    • Lower boundary shifting 00:00:00,001 down by a second shifts to 00:00:00,000

    • Shifting above the 24 hour boundary works fine (25, 26, 27 hours) and doesn’t rollover back to 00 hours

Requirements

You must have Gemcutter registered in your gem sources

Install

sudo gem install thuss-shift_subtitle

Usage

shift_subtitle –operation add –time 2,500 input output

Todo

  • Add a –version flag

  • Perhaps throw a warning if a subtraction shift results in the floor of 00:00:00,000

Copyright © 2009 Todd Huss. See LICENSE for details.