Created
July 9, 2012 15:57
-
-
Save julik/3077306 to your computer and use it in GitHub Desktop.
Consolidate all used takes (first in point to last out point) from all EDLs in this directory (writes to STDOUT)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'edl' | |
class ConsolidatedClip | |
attr_reader :in, :out, :reel, :members | |
def initialize(members) | |
@in = members.map {|e| e.capture_from_tc }.sort[0] | |
@out = members.map {|e| e.capture_to_tc }.sort[-1] | |
@reel = members[0].reel | |
@members = members | |
end | |
def to_s | |
"#{@reel}: #{@in} -> #{@out} (collated #{@members.length} clips)" | |
end | |
end | |
edl_files_here = Dir.entries(".").select{|e| e =~ /^[^.](.+)\.edl$/i } | |
$stderr.puts "Scanning #{edl_files_here.join(', ')}" | |
all_events = edl_files_here.map do | file_name | | |
File.open(file_name) do | f | | |
EDL::Parser.new(25).parse(f) | |
end | |
end.flatten | |
$stderr.puts "Found #{all_events.length} events total" | |
unique_red_clips = all_events.map{|e| e.reel }.uniq | |
$stderr.puts "..using #{unique_red_clips.length} unique reels" | |
capture_clips = unique_red_clips.map do | red_clip | | |
used_slots = all_events.select{|e| e.reel == red_clip } | |
clip = ConsolidatedClip.new(used_slots) | |
end | |
puts "TITLE: CONSOLIDATED" | |
puts "FCM: NON-DROP FRAME" | |
playhead = Timecode.parse("1h", 25) | |
capture_clips.each_with_index do | clip, i | | |
rec_in = playhead | |
playhead += (clip.out - clip.in) | |
puts "%03d\t%s\tV\tC\t%s\t%s\t%s\t%s" % [i+1, clip.reel, clip.in, clip.out, rec_in, playhead] | |
clip.members.each do | member | | |
puts "* USED BY #{member}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment