Skip to content

Instantly share code, notes, and snippets.

@julik
Created January 20, 2011 17:46
Show Gist options
  • Save julik/788256 to your computer and use it in GitHub Desktop.
Save julik/788256 to your computer and use it in GitHub Desktop.
Quickly log some clips for capturing from tape (outputs an EDL)
require "rubygems"
require "timecode"
class Caplist
class Evt
attr_reader :start, :upto
def initialize(from, upto_and_including)
@start = from
@upto = upto_and_including
raise "Neg TC! #{@start} to #{@upto}" if @start > @upto
end
def head_handle(some)
@start = (@start - some)
self
end
def tail_handle(some)
@upto = (@upto + some)
self
end
include Comparable
def <=>(another)
self.start <=> another.start
end
def length
@upto.total - @start.total
end
end
attr_reader :clips
def initialize
@clips = []
end
def log_from(start_tc, length)
t = Timecode.parse(start_tc)
@clips.push(Evt.new(t, t + length))
@clips[-1]
end
def log_from_to(start_tc, end_tc)
s, e = Timecode.parse(start_tc), Timecode.parse(end_tc)
(s, e = e, s) if s > e
@clips.push(Evt.new(s, e))
@clips[-1]
end
def log_to(upto_tc, length)
t = Timecode.parse(upto_tc)
@clips.push(Evt.new(t - length, t))
@clips[-1]
end
def to_edl
current = Timecode.new(0)
puts 'TITLE: PLATES.'
@clips.sort.each_with_index do | c, i |
puts "%03d XFER V C %s %s %s %s" % [i + 1, c.start, c.upto + 1, current, current + c.length + 1]
current = current + c.length
end
end
end
c = Caplist.new
c.log_from("10:08:00:08", 50)
c.log_from_to("06:08:47:10", "06:08:48:12")
c.log_from_to("06:08:11:13", "06:08:12:10")
c.log_from_to("06:08:22:00", "06:08:22:08")
c.log_from_to("07:00:18:04", "07:00:18:24")
c.log_from_to("07:00:57:20", "07:00:58:14")
c.log_from_to("07:03:08:00", "07:03:09:20").tail_handle(25).head_handle(25)
c.log_from_to("08:04:23:08", "08:04:24:08")
c.log_from_to("02:01:35:07", "02:01:35:15")
c.log_from_to("02:02:23:16", "02:02:24:14")
c.log_from_to("02:02:44:09", "02:02:45:20")
c.log_from_to("07:03:56:22", "07:03:57:21")
c.log_from_to("02:04:08:14", "02:04:09:14").head_handle(25)
c.log_from_to("01:00:56:09", "01:00:56:09")
c.log_from_to("01:01:58:21", "01:01:59:11")
# dude in car
c.log_from_to("07:09:16:04", "07:09:16:17").tail_handle(50)
c.log_to("07:09:22:15", 30)
c.log_from_to("08:00:15:23", "08:00:16:12")
c.log_from_to("08:03:19:15", "08:03:20:00")
c.log_from_to("07:06:13:19", "07:06:14:07")
c.log_from_to("07:06:13:19", "07:06:14:07")
c.log_from_to("07:07:47:18", "07:07:47:23")
c.log_from_to("07:07:47:18", "07:07:47:23")
c.log_from_to("07:07:57:05", "07:07:56:21")
c.log_from_to("07:08:08:14", "07:08:08:06")
c.log_from_to("08:00:38:05", "08:00:38:17")
# Averaged!!
c.log_from_to("01:05:56:10", "01:05:59:00")
c.log_from_to("01:09:48:00", "01:10:12:20")
c.log_from_to("07:07:01:18", "07:07:01:22")
c.log_from_to("07:06:55:13", "07:06:55:17")
c.log_from_to("07:07:50:21", "07:07:51:02")
c.log_from_to("09:04:02:18", "09:04:03:06")
c.log_from_to("09:04:04:09", "09:04:05:03")
c.log_from_to("09:02:52:05", "09:02:53:03")
c.log_from_to("09:04:35:04", "09:04:34:12")
c.log_from_to("09:05:00:24", "09:05:01:10").tail_handle(25)
c.log_to("09:05:48:10", 50).tail_handle(25)
# average!
c.log_from_to("01:06:00:00", "01:06:08:00")
c.log_from_to("02:07:08:18", "02:07:19:24").head_handle(10).tail_handle(10)
c.log_from_to("01:06:52:18", "01:06:54:01")
c.log_from_to("01:11:03:22", "01:11:04:08")
# average!
c.log_from_to("02:07:32:10", "02:07:34:18").tail_handle(10).head_handle(10)
c.log_from_to("02:07:56:10", "02:07:56:19")
c.log_from_to("05:09:14:08", "05:09:15:13").tail_handle(25)
c.log_from_to("05:03:17:22", "05:03:18:05").head_handle(25)
c.log_from_to("05:00:17:20", "05:00:18:18")
c.log_from_to("05:08:22:05", "05:08:22:21")
c.log_from_to("05:04:04:15", "05:04:06:05")
c.log_from_to("05:10:14:24", "05:10:15:21")
c.log_from_to("05:10:41:19", "05:10:42:11")
c.log_from_to("05:11:23:15", "05:11:24:17")
c.log_from_to("06:00:22:13", "06:00:24:16").tail_handle(25)
c.log_from_to("06:02:30:15", "06:02:31:16")
c.log_from_to("01:00:44:23", "01:00:45:11")
c.log_from_to("10:11:01:05", "10:11:02:12")
c.log_from_to("10:11:18:04", "10:11:18:17")
c.log_from_to("10:10:35:01", "10:10:35:14")
c.log_from_to("01:01:57:11", "01:01:57:23")
c.log_from_to("10:08:47:22", "10:08:48:15")
c.log_from_to("10:10:52:05", "10:10:53:00")
c.log_from_to("10:09:18:21", "10:09:19:06")
c.log_from_to("03:01:33:12", "03:01:33:21").head_handle(25)
c.log_from_to("10:10:55:10", "10:10:56:08").tail_handle(25)
# SKIP - timelapse motorway
c.log_from_to("04:00:03:23", "04:00:04:04")
c.log_from_to("04:00:06:14", "04:00:36:00")
c.log_from_to("08:01:24:11", "08:01:26:01")
c.log_from_to("04:00:53:00", "04:00:58:01")
c.log_from_to("06:07:08:24", "06:07:09:23")
c.log_from_to("06:02:53:06", "06:02:54:22")
c.log_from_to("06:03:29:11", "06:03:30:02")
c.log_from_to("06:04:04:17", "06:04:05:05")
c.log_from_to("09:00:08:17", "09:00:09:08").tail_handle(25)
c.log_from_to("03:11:20:00", "03:11:20:16").tail_handle(25).head_handle(25)
c.log_from_to("03:10:46:00", "03:10:46:10").tail_handle(25).head_handle(25)
c.log_from_to("03:10:51:10", "03:10:51:13").head_handle(25).tail_handle(25)
c.log_from_to("03:11:53:10", "03:11:54:00").head_handle(30).tail_handle(30)
c.log_from_to("06:05:00:19", "06:05:01:16").head_handle(25)
c.log_from_to("06:06:45:16", "06:06:46:05")
c.log_from_to("09:00:27:16", "09:00:28:01").tail_handle(25)
# Key sjot
c.log_from_to("10:01:54:02", "10:01:54:10").tail_handle(50)
c.log_to("08:01:26:08", 50)
c.log_from_to("03:01:12:00", "03:01:12:08")
c.log_from_to("03:03:07:15", "03:03:08:04")
c.log_from_to("03:02:30:04", "03:02:30:15")
c.log_from_to("03:03:32:20", "03:03:33:12")
c.log_from_to("03:04:46:02", "03:04:46:20")
c.log_from_to("03:05:12:11", "03:05:29:13").tail_handle(25)
# dissolves fucking galore
c.log_from_to("08:01:17:10", "08:01:18:18")
c.log_from_to("08:02:39:13", "08:02:41:19")
c.log_from_to("03:06:05:18", "03:06:06:06")
c.log_from_to("03:07:15:02", "03:07:15:21")
c.log_from_to("01:07:54:00", "01:07:58:23")
c.log_from_to("04:01:14:10", "04:01:17:03").tail_handle(10)
c.to_edl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment