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
95 96 97 |
# File 'lib/edl.rb', line 95 def capture_list without_generators.without_timewarps.spliced.from_zero end |
#events ⇒ Object
:nodoc:
20 21 22 23 |
# File 'lib/edl.rb', line 20 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
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/edl.rb', line 101 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
61 62 63 64 65 66 67 68 |
# File 'lib/edl.rb', line 61 def renumbered renumed = self.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
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/edl.rb', line 115 def spliced spliced_edl = inject([]) do | spliced, cur | 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 spliced 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”
90 91 92 |
# File 'lib/edl.rb', line 90 def without_generators self.class.new(self.reject{|e| e.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)
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/edl.rb', line 73 def without_timewarps self.class.new( map do | e | if e.has_timewarp? repl = e.copy_properties_to(e.class.new) from, to = e.timewarp.actual_src_start_tc, e.timewarp.actual_src_end_tc repl.src_start_tc, repl.src_end_tc, repl.timewarp = from, to, nil repl else e end end ) end |
#without_transitions ⇒ Object
Return the same EDL with all dissolves stripped and replaced by the clips underneath
26 27 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 |
# File 'lib/edl.rb', line 26 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 |