edl 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -5
- data/Rakefile +1 -1
- data/lib/edl.rb +2 -47
- data/lib/edl/event.rb +3 -3
- data/test/test_edl.rb +7 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
=== 0.0.
|
1
|
+
=== 0.0.8 / 2009-01-18
|
2
|
+
|
3
|
+
* Switch Rubyforge project to guerilla-di
|
4
|
+
|
5
|
+
=== 0.0.7 / 2009-01-18
|
2
6
|
|
3
7
|
* Register line_number in the original EDL for parsed events
|
4
8
|
* Preserve the star in comments that have it
|
5
9
|
|
6
|
-
=== 0.0.6 /
|
10
|
+
=== 0.0.6 / 2009-01-14
|
7
11
|
|
8
12
|
* Fix comments in events appearing twice
|
9
13
|
* Capture extra comments that have no star at the beginning as fallback
|
10
14
|
|
11
|
-
=== 0.0.5 /
|
15
|
+
=== 0.0.5 / 2009-01-14
|
12
16
|
|
13
17
|
* EDL::Event#starts_with_transition? is an alias
|
14
18
|
* EDL::Event#incoming_transition_duration works as a shortcut for EDL::Transition#duration
|
15
19
|
|
16
|
-
=== 0.0.4 /
|
20
|
+
=== 0.0.4 / 2009-01-14
|
17
21
|
|
18
22
|
* EDL::Event#speed works as a shortcut for timewarp speed
|
19
23
|
|
20
|
-
=== 0.0.2 /
|
24
|
+
=== 0.0.2 / 2009-01-14
|
21
25
|
|
22
26
|
* Fix reverse timewarps
|
23
27
|
* Migrate to specs
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ Hoe::RUBY_FLAGS.replace ENV['RUBY_FLAGS'] || "-I#{%w(lib test).join(File::PATH_S
|
|
7
7
|
(Hoe::RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
|
8
8
|
|
9
9
|
Hoe.new('edl', EDL::VERSION) do |p|
|
10
|
-
p.rubyforge_name = '
|
10
|
+
p.rubyforge_name = 'guerilla-di'
|
11
11
|
p.developer('Julik', 'me@julik.nl')
|
12
12
|
p.extra_deps << "flexmock" << "timecode" << "test-spec"
|
13
13
|
p.remote_rdoc_dir = 'edl'
|
data/lib/edl.rb
CHANGED
@@ -5,10 +5,11 @@ require 'stringio'
|
|
5
5
|
require File.dirname(__FILE__) + '/edl/event'
|
6
6
|
require File.dirname(__FILE__) + '/edl/transition'
|
7
7
|
require File.dirname(__FILE__) + '/edl/timewarp'
|
8
|
+
require File.dirname(__FILE__) + '/edl/parser'
|
8
9
|
|
9
10
|
# A simplistic EDL parser
|
10
11
|
module EDL
|
11
|
-
VERSION = "0.0.
|
12
|
+
VERSION = "0.0.8"
|
12
13
|
DEFAULT_FPS = 25.0
|
13
14
|
|
14
15
|
# Represents an EDL, is returned from the parser. Traditional operation is functional style, i.e.
|
@@ -314,51 +315,5 @@ module EDL
|
|
314
315
|
end
|
315
316
|
|
316
317
|
#:startdoc:
|
317
|
-
|
318
|
-
# Is used to parse an EDL
|
319
|
-
class Parser
|
320
|
-
|
321
|
-
attr_reader :fps
|
322
|
-
|
323
|
-
# Initialize an EDL parser. Pass the FPS to it, as the usual EDL does not contain any kind of reference
|
324
|
-
# to it's framerate
|
325
|
-
def initialize(with_fps = DEFAULT_FPS)
|
326
|
-
@fps = with_fps
|
327
|
-
end
|
328
|
-
|
329
|
-
def get_matchers #:nodoc:
|
330
|
-
[ EventMatcher.new(@fps), EffectMatcher.new, NameMatcher.new, TimewarpMatcher.new(@fps), CommentMatcher.new ]
|
331
|
-
end
|
332
|
-
|
333
|
-
# Parse a passed File or IO object line by line, or the whole string
|
334
|
-
def parse(io)
|
335
|
-
return parse(StringIO.new(io.to_s)) unless io.respond_to?(:eof?)
|
336
|
-
|
337
|
-
stack, matchers = List.new, get_matchers
|
338
|
-
|
339
|
-
at_line = 0
|
340
|
-
until io.eof?
|
341
|
-
at_line += 1
|
342
|
-
|
343
|
-
current_line = io.gets.strip
|
344
|
-
m = matchers.find{|m| m.matches?(current_line) }
|
345
|
-
next unless m
|
346
|
-
|
347
|
-
begin
|
348
|
-
m.apply(stack, current_line)
|
349
|
-
stack[-1].line_number = at_line if m.is_a?(EventMatcher)
|
350
|
-
rescue Matcher::ApplyError => e
|
351
|
-
STDERR.puts "Cannot parse #{current_line} - #{e}"
|
352
|
-
end
|
353
|
-
end
|
354
|
-
stack
|
355
|
-
end
|
356
|
-
|
357
|
-
# Init a Timecode object from the passed elements with the passed framerate
|
358
|
-
def self.timecode_from_line_elements(elements, fps) #:nodoc:
|
359
|
-
args = (0..3).map{|_| elements.shift.to_i} + [fps.to_f]
|
360
|
-
Timecode.at(*args)
|
361
|
-
end
|
362
|
-
end
|
363
318
|
|
364
319
|
end
|
data/lib/edl/event.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module EDL
|
2
|
-
# Represents an edit event
|
2
|
+
# Represents an edit event (or, more specifically, an EDL line denoting a clip being part of an EDL event)
|
3
3
|
class Event
|
4
4
|
# Event number as in the EDL
|
5
5
|
attr_accessor :num
|
@@ -111,7 +111,7 @@ module EDL
|
|
111
111
|
(rec_end_tc.to_i - rec_start_tc.to_i).to_i
|
112
112
|
end
|
113
113
|
|
114
|
-
# Get the record length of the event (how long it occupies in the EDL
|
114
|
+
# Get the record length of the event (how long it occupies in the EDL with an eventual outgoing transition)
|
115
115
|
def rec_length_with_transition
|
116
116
|
rec_length + outgoing_transition_duration.to_i
|
117
117
|
end
|
@@ -135,7 +135,7 @@ module EDL
|
|
135
135
|
|
136
136
|
# Speed of this clip in percent relative to the source speed. 100 for non-timewarped events
|
137
137
|
def speed
|
138
|
-
@timewarp ? @timewarp.speed : 100
|
138
|
+
@timewarp ? @timewarp.speed : 100.0
|
139
139
|
end
|
140
140
|
|
141
141
|
# Returns true if this event is a generator
|
data/test/test_edl.rb
CHANGED
@@ -110,6 +110,11 @@ context "An Event should" do
|
|
110
110
|
e.src_length.should.equal "2s".tc.to_i
|
111
111
|
end
|
112
112
|
|
113
|
+
specify "support line_number" do
|
114
|
+
EDL::Event.new.line_number.should.be.nil
|
115
|
+
EDL::Event.new(:line_number => 3).line_number.should.equal 3
|
116
|
+
end
|
117
|
+
|
113
118
|
specify "support capture_length as an alias to src_length" do
|
114
119
|
tw = flexmock
|
115
120
|
tw.should_receive(:actual_length_of_source).and_return(:something)
|
@@ -139,7 +144,8 @@ context "An Event should" do
|
|
139
144
|
|
140
145
|
specify "report speed as 100 percent without a timewarp" do
|
141
146
|
e = EDL::Event.new
|
142
|
-
e.speed.should.
|
147
|
+
e.speed.should.be.kind_of Float
|
148
|
+
e.speed.should.equal 100.0
|
143
149
|
end
|
144
150
|
|
145
151
|
specify "consult the timewarp for speed" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-18 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version:
|
111
111
|
requirements: []
|
112
112
|
|
113
|
-
rubyforge_project:
|
113
|
+
rubyforge_project: guerilla-di
|
114
114
|
rubygems_version: 1.3.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 2
|