edl 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/Rakefile +4 -0
- data/SPECS.txt +3 -2
- data/lib/edl.rb +8 -3
- data/lib/edl/event.rb +3 -0
- data/test/test_edl.rb +15 -4
- metadata +1 -1
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -2,6 +2,10 @@ require 'rubygems'
|
|
2
2
|
require 'hoe'
|
3
3
|
require './lib/edl.rb'
|
4
4
|
|
5
|
+
# Disable spurious warnings when running tests, ActiveMagic cannot stand -w
|
6
|
+
Hoe::RUBY_FLAGS.replace ENV['RUBY_FLAGS'] || "-I#{%w(lib test).join(File::PATH_SEPARATOR)}" +
|
7
|
+
(Hoe::RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
|
8
|
+
|
5
9
|
Hoe.new('edl', EDL::VERSION) do |p|
|
6
10
|
p.rubyforge_name = 'wiretap'
|
7
11
|
p.developer('Julik', 'me@julik.nl')
|
data/SPECS.txt
CHANGED
@@ -38,7 +38,8 @@
|
|
38
38
|
* parse from a File/IOish
|
39
39
|
* properly parse a dissolve
|
40
40
|
* return a spliced EDL if the sources allow
|
41
|
-
* not apply any Matchers if a match is found
|
41
|
+
* not apply any Matchers if a match is found
|
42
|
+
* register line numbers of the detected events
|
42
43
|
|
43
44
|
== A TimewarpMatcher should
|
44
45
|
* not create any extra events when used within a Parser
|
@@ -92,4 +93,4 @@
|
|
92
93
|
== A FinalCutPro speedup and reverse with fade at the end should
|
93
94
|
* parse cleanly
|
94
95
|
|
95
|
-
|
96
|
+
66 specifications, 1 empty (173 requirements), 0 failures
|
data/lib/edl.rb
CHANGED
@@ -8,8 +8,8 @@ require File.dirname(__FILE__) + '/edl/timewarp'
|
|
8
8
|
|
9
9
|
# A simplistic EDL parser
|
10
10
|
module EDL
|
11
|
-
VERSION = "0.0.
|
12
|
-
DEFAULT_FPS = 25
|
11
|
+
VERSION = "0.0.7"
|
12
|
+
DEFAULT_FPS = 25.0
|
13
13
|
|
14
14
|
# Represents an EDL, is returned from the parser. Traditional operation is functional style, i.e.
|
15
15
|
# edl.renumbered.without_transitions.without_generators
|
@@ -156,7 +156,7 @@ module EDL
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def apply(stack, line)
|
159
|
-
stack[-1].comments
|
159
|
+
stack[-1].comments.push("* %s" % line.scan(@regexp).flatten.pop.strip)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -335,13 +335,18 @@ module EDL
|
|
335
335
|
return parse(StringIO.new(io.to_s)) unless io.respond_to?(:eof?)
|
336
336
|
|
337
337
|
stack, matchers = List.new, get_matchers
|
338
|
+
|
339
|
+
at_line = 0
|
338
340
|
until io.eof?
|
341
|
+
at_line += 1
|
342
|
+
|
339
343
|
current_line = io.gets.strip
|
340
344
|
m = matchers.find{|m| m.matches?(current_line) }
|
341
345
|
next unless m
|
342
346
|
|
343
347
|
begin
|
344
348
|
m.apply(stack, current_line)
|
349
|
+
stack[-1].line_number = at_line if m.is_a?(EventMatcher)
|
345
350
|
rescue Matcher::ApplyError => e
|
346
351
|
STDERR.puts "Cannot parse #{current_line} - #{e}"
|
347
352
|
end
|
data/lib/edl/event.rb
CHANGED
@@ -40,6 +40,9 @@ module EDL
|
|
40
40
|
# How long is the incoming transition on the next event
|
41
41
|
attr_accessor :outgoing_transition_duration
|
42
42
|
|
43
|
+
# Where is this event located in the original file
|
44
|
+
attr_accessor :line_number
|
45
|
+
|
43
46
|
def initialize(opts = {})
|
44
47
|
opts.each_pair{|k,v| send("#{k}=", v) }
|
45
48
|
yield(self) if block_given?
|
data/test/test_edl.rb
CHANGED
@@ -290,8 +290,19 @@ context "A Parser should" do
|
|
290
290
|
m1.should_receive(:apply).once
|
291
291
|
|
292
292
|
flexmock(p).should_receive(:get_matchers).once.and_return([m1, m1])
|
293
|
+
result = p.parse("plop")
|
294
|
+
result.should.be.empty
|
295
|
+
end
|
296
|
+
|
297
|
+
specify "register line numbers of the detected events" do
|
298
|
+
p = EDL::Parser.new
|
299
|
+
events = p.parse(File.open(SPLICEME))
|
300
|
+
|
301
|
+
events[0].line_number.should.not.be.nil
|
302
|
+
events[0].line_number.should.equal 4
|
293
303
|
|
294
|
-
|
304
|
+
events[1].line_number.should.not.be.nil
|
305
|
+
events[1].line_number.should.equal 5
|
295
306
|
end
|
296
307
|
end
|
297
308
|
|
@@ -492,7 +503,7 @@ context "CommentMatcher should" do
|
|
492
503
|
2.times { mok_evt.should_receive(:comments).and_return(comments) }
|
493
504
|
2.times { EDL::CommentMatcher.new.apply([mok_evt], line) }
|
494
505
|
|
495
|
-
mok_evt.comments.should.equal ["COMMENT: PURE BULLSHIT", "COMMENT: PURE BULLSHIT"]
|
506
|
+
mok_evt.comments.should.equal ["* COMMENT: PURE BULLSHIT", "* COMMENT: PURE BULLSHIT"]
|
496
507
|
end
|
497
508
|
end
|
498
509
|
|
@@ -548,7 +559,7 @@ context "ClipNameMatcher should" do
|
|
548
559
|
mok_evt.should_receive(:comments).and_return(comments).once
|
549
560
|
|
550
561
|
EDL::NameMatcher.new.apply([mok_evt], line)
|
551
|
-
comments.should.equal ["FROM CLIP NAME: TAPE_6-10.MOV"]
|
562
|
+
comments.should.equal ["* FROM CLIP NAME: TAPE_6-10.MOV"]
|
552
563
|
end
|
553
564
|
|
554
565
|
end
|
@@ -576,7 +587,7 @@ context "EffectMatcher should" do
|
|
576
587
|
|
577
588
|
EDL::EffectMatcher.new.apply([mok_evt], line)
|
578
589
|
|
579
|
-
cmt.should.equal ["EFFECT NAME: CROSS DISSOLVE"]
|
590
|
+
cmt.should.equal ["* EFFECT NAME: CROSS DISSOLVE"]
|
580
591
|
end
|
581
592
|
|
582
593
|
end
|