edl 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.0.7 / 2000-01-18
2
+
3
+ * Register line_number in the original EDL for parsed events
4
+ * Preserve the star in comments that have it
5
+
1
6
  === 0.0.6 / 2000-01-14
2
7
 
3
8
  * Fix comments in events appearing twice
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 (empty)
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
- 65 specifications, 2 empty (168 requirements), 0 failures
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.6"
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 << line.scan(@regexp).flatten.pop.strip
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
- p.parse("plop")
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
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik