Class: EDL::List
- Inherits:
-
Array
- Object
- Array
- EDL::List
- Defined in:
- lib/edl.rb
Overview
Represents an EDL, is returned from the parser. Traditional operation is functional style, i.e.
edl.renumbered.without_transitions.without_generators
Instance Method Summary collapse
-
#capture_list ⇒ Object
Return the list of clips used by this EDL at full capture length.
-
#events ⇒ Object
:nodoc:.
-
#from_zero ⇒ Object
Return the same EDL with the first event starting at 00:00:00:00 and all subsequent events shifted accordingly.
-
#renumbered ⇒ Object
Return the same EDL, with events renumbered starting from 001.
-
#spliced ⇒ Object
Return the same EDL with neighbouring clips joined at cuts where applicable (if a clip is divided in two pieces it will be spliced).
-
#without_generators ⇒ Object
Return the same EDL without AX, BL and other GEN events (like slug, text and solids).
-
#without_timewarps ⇒ Object
Return the same EDL with all timewarps expanded to native length.
-
#without_transitions ⇒ Object
Return the same EDL with all dissolves stripped and replaced by the clips underneath.
Instance Method Details
#capture_list ⇒ Object
Return the list of clips used by this EDL at full capture length
100 101 102 |
# File 'lib/edl.rb', line 100 def capture_list without_generators.without_timewarps.spliced.from_zero end |
#events ⇒ Object
:nodoc:
22 23 24 25 |
# File 'lib/edl.rb', line 22 def events #:nodoc: STDERR.puts 'EDL::List#events is deprecated and will be removed, use EDL::List as an array instead' self end |
#from_zero ⇒ Object
Return the same EDL with the first event starting at 00:00:00:00 and all subsequent events shifted accordingly
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/edl.rb', line 106 def from_zero shift_by = self[0].rec_start_tc self.class.new( map do |original| e = original.dup e.rec_start_tc = (e.rec_start_tc - shift_by) e.rec_end_tc = (e.rec_end_tc - shift_by) e end ) end |
#renumbered ⇒ Object
Return the same EDL, with events renumbered starting from 001
63 64 65 66 67 68 69 70 |
# File 'lib/edl.rb', line 63 def renumbered renumed = dup pad = renumed.length.to_s.length pad = 3 if pad < 3 (0...renumed.length).map { |e| renumed[e].num = "%0#{pad}d" % (e + 1) } self.class.new(renumed) end |
#spliced ⇒ Object
Return the same EDL with neighbouring clips joined at cuts where applicable (if a clip is divided in two pieces it will be spliced). Most useful in combination with without_timewarps
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/edl.rb', line 120 def spliced spliced_edl = each_with_object([]) do |cur, spliced| latest = spliced[-1] # Append to latest if splicable if latest && (latest.reel == cur.reel) && (cur.src_start_tc == (latest.src_end_tc + 1)) latest.src_end_tc = cur.src_end_tc latest.rec_end_tc = cur.rec_end_tc else spliced << cur.dup end end self.class.new(spliced_edl) end |
#without_generators ⇒ Object
Return the same EDL without AX, BL and other GEN events (like slug, text and solids). Usually used in concert with “without_transitions”
95 96 97 |
# File 'lib/edl.rb', line 95 def without_generators self.class.new(reject(&:generator?)) end |
#without_timewarps ⇒ Object
Return the same EDL with all timewarps expanded to native length. Clip length changes have rippling effect on footage that comes after the timewarped clip (so this is best used in concert with the original EDL where record TC is pristine)
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/edl.rb', line 75 def without_timewarps self.class.new( map do |e| if e.has_timewarp? repl = e.copy_properties_to(e.class.new) from = e.timewarp.actual_src_start_tc to = e.timewarp.actual_src_end_tc repl.src_start_tc = from repl.src_end_tc = to repl.timewarp = nil repl else e end end ) end |
#without_transitions ⇒ Object
Return the same EDL with all dissolves stripped and replaced by the clips underneath
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/edl.rb', line 28 def without_transitions # Find dissolves cpy = [] each_with_index do |e, i| # A dissolve always FOLLOWS the incoming clip if e.ends_with_transition? dissolve = self[i + 1] len = dissolve.transition.duration.to_i # The dissolve contains the OUTGOING clip, we are the INCOMING. Extend the # incoming clip by the length of the dissolve, that's the whole mission actually incoming = e.copy_properties_to(e.class.new) incoming.src_end_tc += len incoming.rec_end_tc += len outgoing = dissolve.copy_properties_to(Event.new) # Add the A suffix to the ex-dissolve outgoing.num += 'A' # Take care to join the two if they overlap - TODO cpy << incoming cpy << outgoing elsif e.has_transition? # Skip, already handled on the previous clip else cpy << e.dup end end # Do not renumber events # (0...cpy.length).map{|e| cpy[e].num = "%03d" % e } self.class.new(cpy) end |