tracksperanto 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -3
- data/History.txt +4 -0
- data/lib/import/nuke_script.rb +1 -11
- data/lib/import/shake_grammar/lexer.rb +12 -3
- data/lib/tracksperanto.rb +1 -2
- data/tracksperanto.gemspec +14 -13
- metadata +27 -13
- data/lib/tracksperanto/buffering_reader.rb +0 -40
- data/test/test_bufferingreader.rb +0 -48
data/Gemfile
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
source :rubygems
|
3
3
|
|
4
|
-
gem "
|
5
|
-
gem "obuf", "~> 1.1
|
4
|
+
# gem "bychar", "~> 1.1" - controlled by Tickly
|
5
|
+
gem "obuf", "~> 1.1"
|
6
|
+
gem "tickly", "~> 0.0.8"
|
6
7
|
gem "progressive_io", "~> 1.0"
|
7
8
|
gem "flame_channel_parser", "~> 4.0"
|
8
9
|
gem "progressbar", "0.10.0"
|
9
10
|
gem "update_hints", "~> 1.0"
|
10
11
|
|
12
|
+
|
11
13
|
group :development do
|
12
14
|
gem "approximately"
|
13
15
|
gem "jeweler"
|
14
16
|
gem "rake"
|
15
|
-
|
17
|
+
|
18
|
+
if RUBY_VERSION > "1.8"
|
19
|
+
gem "flexmock", "~> 1.3"
|
20
|
+
else
|
21
|
+
gem "flexmock", "~> 0.8"
|
22
|
+
end
|
23
|
+
|
16
24
|
gem "cli_test", "~>1.0"
|
17
25
|
gem "rake-hooks"
|
26
|
+
gem "ruby-prof"
|
18
27
|
end
|
data/History.txt
CHANGED
data/lib/import/nuke_script.rb
CHANGED
@@ -16,21 +16,11 @@ class Tracksperanto::Import::NukeScript < Tracksperanto::Import::Base
|
|
16
16
|
'The only supported nodes that we can extract tracks from are Reconcile3D, PlanarTracker and Tracker (supported Nuke versions are 5, 6 and 7)'
|
17
17
|
end
|
18
18
|
|
19
|
-
class Tickly::Parser
|
20
|
-
end
|
21
|
-
|
22
|
-
class Levaluator < Tickly::Evaluator
|
23
|
-
def evaluate(expr)
|
24
|
-
s = super
|
25
|
-
yield(s) if s
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
19
|
def each
|
30
20
|
parser = Tickly::NodeExtractor.new("Tracker3", "Tracker4", "PlanarTracker1_0", "Reconcile3D")
|
31
21
|
script_tree = Tickly::Parser.new.parse(@io)
|
32
22
|
|
33
|
-
evaluator =
|
23
|
+
evaluator = Tickly::Evaluator.new
|
34
24
|
evaluator.add_node_handler_class(Tracker3)
|
35
25
|
evaluator.add_node_handler_class(Reconcile3D)
|
36
26
|
evaluator.add_node_handler_class(PlanarTracker1_0)
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
+
require 'bychar'
|
3
|
+
|
2
4
|
module Tracksperanto::ShakeGrammar
|
3
5
|
class WrongInputError < RuntimeError; end
|
4
6
|
|
@@ -25,9 +27,16 @@ module Tracksperanto::ShakeGrammar
|
|
25
27
|
# that will cache in chunks, and then read from there byte by byte. This yields a substantial speedup (4.9 seconds for the test
|
26
28
|
# as opposed to 7.9 without this). We do check for the proper class only once so that when we use nested lexers
|
27
29
|
# we only wrap the passed IO once, and only if necessary.
|
28
|
-
with_io =
|
30
|
+
with_io = Bychar::Reader.new(with_io) unless with_io.respond_to?(:read_one_byte)
|
29
31
|
@io, @stack, @buf, @sentinel, @limit_to_one_stmt, @stack_depth = with_io, [], '', sentinel, limit_to_one_stmt, stack_depth
|
30
|
-
|
32
|
+
|
33
|
+
catch(STOP_TOKEN) do
|
34
|
+
begin
|
35
|
+
loop { parse }
|
36
|
+
rescue Bychar::EOFError
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
@in_comment ? consume_comment! : consume_atom!
|
32
41
|
end
|
33
42
|
|
@@ -44,7 +53,7 @@ module Tracksperanto::ShakeGrammar
|
|
44
53
|
|
45
54
|
def parse
|
46
55
|
|
47
|
-
c = @io.read_one_byte
|
56
|
+
c = @io.read_one_byte!
|
48
57
|
|
49
58
|
if @buf.length > MAX_BUFFER_SIZE # Wrong format and the buffer is filled up, bail
|
50
59
|
raise WrongInputError, "Atom buffer overflow at #{MAX_BUFFER_SIZE} bytes, this is definitely not a Shake script"
|
data/lib/tracksperanto.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Tracksperanto
|
5
5
|
PATH = File.expand_path(File.dirname(__FILE__))
|
6
|
-
VERSION = '3.2.
|
6
|
+
VERSION = '3.2.2'
|
7
7
|
|
8
8
|
module Import; end
|
9
9
|
module Export; end
|
@@ -100,7 +100,6 @@ end
|
|
100
100
|
buffer_io
|
101
101
|
simple_export
|
102
102
|
uv_coordinates
|
103
|
-
buffering_reader
|
104
103
|
parameters
|
105
104
|
yield_non_empty
|
106
105
|
pf_coords
|
data/tracksperanto.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "tracksperanto"
|
8
|
-
s.version = "3.2.
|
8
|
+
s.version = "3.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Julik Tarkhanov"]
|
12
|
-
s.date = "2013-03-
|
12
|
+
s.date = "2013-03-16"
|
13
13
|
s.description = "Converts 2D track exports between different apps like Flame, MatchMover, PFTrack..."
|
14
14
|
s.email = "me@julik.nl"
|
15
15
|
s.executables = ["tracksperanto"]
|
@@ -84,7 +84,6 @@ Gem::Specification.new do |s|
|
|
84
84
|
"lib/tracksperanto.rb",
|
85
85
|
"lib/tracksperanto/block_init.rb",
|
86
86
|
"lib/tracksperanto/buffer_io.rb",
|
87
|
-
"lib/tracksperanto/buffering_reader.rb",
|
88
87
|
"lib/tracksperanto/casts.rb",
|
89
88
|
"lib/tracksperanto/const_name.rb",
|
90
89
|
"lib/tracksperanto/ext_io.rb",
|
@@ -168,7 +167,6 @@ Gem::Specification.new do |s|
|
|
168
167
|
"test/subpixel/subpixel_grid.tif",
|
169
168
|
"test/subpixel/sy_subpix_2dpaths.txt",
|
170
169
|
"test/test_buffer_io.rb",
|
171
|
-
"test/test_bufferingreader.rb",
|
172
170
|
"test/test_casts.rb",
|
173
171
|
"test/test_cli.rb",
|
174
172
|
"test/test_const_name.rb",
|
@@ -212,8 +210,8 @@ Gem::Specification.new do |s|
|
|
212
210
|
s.specification_version = 3
|
213
211
|
|
214
212
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
215
|
-
s.add_runtime_dependency(%q<
|
216
|
-
s.add_runtime_dependency(%q<
|
213
|
+
s.add_runtime_dependency(%q<obuf>, ["~> 1.1"])
|
214
|
+
s.add_runtime_dependency(%q<tickly>, ["~> 0.0.8"])
|
217
215
|
s.add_runtime_dependency(%q<progressive_io>, ["~> 1.0"])
|
218
216
|
s.add_runtime_dependency(%q<flame_channel_parser>, ["~> 4.0"])
|
219
217
|
s.add_runtime_dependency(%q<progressbar>, ["= 0.10.0"])
|
@@ -221,12 +219,13 @@ Gem::Specification.new do |s|
|
|
221
219
|
s.add_development_dependency(%q<approximately>, [">= 0"])
|
222
220
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
223
221
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
224
|
-
s.add_development_dependency(%q<flexmock>, ["~>
|
222
|
+
s.add_development_dependency(%q<flexmock>, ["~> 1.3"])
|
225
223
|
s.add_development_dependency(%q<cli_test>, ["~> 1.0"])
|
226
224
|
s.add_development_dependency(%q<rake-hooks>, [">= 0"])
|
225
|
+
s.add_development_dependency(%q<ruby-prof>, [">= 0"])
|
227
226
|
else
|
228
|
-
s.add_dependency(%q<
|
229
|
-
s.add_dependency(%q<
|
227
|
+
s.add_dependency(%q<obuf>, ["~> 1.1"])
|
228
|
+
s.add_dependency(%q<tickly>, ["~> 0.0.8"])
|
230
229
|
s.add_dependency(%q<progressive_io>, ["~> 1.0"])
|
231
230
|
s.add_dependency(%q<flame_channel_parser>, ["~> 4.0"])
|
232
231
|
s.add_dependency(%q<progressbar>, ["= 0.10.0"])
|
@@ -234,13 +233,14 @@ Gem::Specification.new do |s|
|
|
234
233
|
s.add_dependency(%q<approximately>, [">= 0"])
|
235
234
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
236
235
|
s.add_dependency(%q<rake>, [">= 0"])
|
237
|
-
s.add_dependency(%q<flexmock>, ["~>
|
236
|
+
s.add_dependency(%q<flexmock>, ["~> 1.3"])
|
238
237
|
s.add_dependency(%q<cli_test>, ["~> 1.0"])
|
239
238
|
s.add_dependency(%q<rake-hooks>, [">= 0"])
|
239
|
+
s.add_dependency(%q<ruby-prof>, [">= 0"])
|
240
240
|
end
|
241
241
|
else
|
242
|
-
s.add_dependency(%q<
|
243
|
-
s.add_dependency(%q<
|
242
|
+
s.add_dependency(%q<obuf>, ["~> 1.1"])
|
243
|
+
s.add_dependency(%q<tickly>, ["~> 0.0.8"])
|
244
244
|
s.add_dependency(%q<progressive_io>, ["~> 1.0"])
|
245
245
|
s.add_dependency(%q<flame_channel_parser>, ["~> 4.0"])
|
246
246
|
s.add_dependency(%q<progressbar>, ["= 0.10.0"])
|
@@ -248,9 +248,10 @@ Gem::Specification.new do |s|
|
|
248
248
|
s.add_dependency(%q<approximately>, [">= 0"])
|
249
249
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
250
250
|
s.add_dependency(%q<rake>, [">= 0"])
|
251
|
-
s.add_dependency(%q<flexmock>, ["~>
|
251
|
+
s.add_dependency(%q<flexmock>, ["~> 1.3"])
|
252
252
|
s.add_dependency(%q<cli_test>, ["~> 1.0"])
|
253
253
|
s.add_dependency(%q<rake-hooks>, [">= 0"])
|
254
|
+
s.add_dependency(%q<ruby-prof>, [">= 0"])
|
254
255
|
end
|
255
256
|
end
|
256
257
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracksperanto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,16 +9,16 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: obuf
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '1.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,15 +26,15 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '1.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: tickly
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 0.0.8
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 0.0.8
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: progressive_io
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - ~>
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
165
|
+
version: '1.3'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '1.3'
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: cli_test
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,6 +203,22 @@ dependencies:
|
|
203
203
|
- - ! '>='
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: ruby-prof
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
206
222
|
description: Converts 2D track exports between different apps like Flame, MatchMover,
|
207
223
|
PFTrack...
|
208
224
|
email: me@julik.nl
|
@@ -279,7 +295,6 @@ files:
|
|
279
295
|
- lib/tracksperanto.rb
|
280
296
|
- lib/tracksperanto/block_init.rb
|
281
297
|
- lib/tracksperanto/buffer_io.rb
|
282
|
-
- lib/tracksperanto/buffering_reader.rb
|
283
298
|
- lib/tracksperanto/casts.rb
|
284
299
|
- lib/tracksperanto/const_name.rb
|
285
300
|
- lib/tracksperanto/ext_io.rb
|
@@ -363,7 +378,6 @@ files:
|
|
363
378
|
- test/subpixel/subpixel_grid.tif
|
364
379
|
- test/subpixel/sy_subpix_2dpaths.txt
|
365
380
|
- test/test_buffer_io.rb
|
366
|
-
- test/test_bufferingreader.rb
|
367
381
|
- test/test_casts.rb
|
368
382
|
- test/test_cli.rb
|
369
383
|
- test/test_const_name.rb
|
@@ -411,7 +425,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
411
425
|
version: '0'
|
412
426
|
segments:
|
413
427
|
- 0
|
414
|
-
hash:
|
428
|
+
hash: 419869014882253399
|
415
429
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
416
430
|
none: false
|
417
431
|
requirements:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
# Shake uses this reader to parse byte by byte without having to read byte by byte.
|
3
|
-
# Reading byte by byte is very inefficient, but we want to parse byte by byte since
|
4
|
-
# this makes parser construction much easier. So what we do is cache some chunk of the
|
5
|
-
# passed buffer and read from that. Once exhausted there will be some caching again,
|
6
|
-
# and ad infinitum until the passed buffer is exhausted
|
7
|
-
class Tracksperanto::BufferingReader
|
8
|
-
|
9
|
-
DEFAULT_BUFFER_SIZE = 64 * 1024
|
10
|
-
|
11
|
-
def initialize(with_io, buffer_size = DEFAULT_BUFFER_SIZE)
|
12
|
-
@io = with_io
|
13
|
-
@bufsize = buffer_size
|
14
|
-
@buf = StringIO.new
|
15
|
-
end
|
16
|
-
|
17
|
-
# Will transparently read one byte off the contained IO, maintaining the internal cache.
|
18
|
-
# If the cache has been depleted it will read a big chunk from the IO and cache it and then
|
19
|
-
# return the byte
|
20
|
-
def read_one_byte
|
21
|
-
cache if @buf.pos == @buf.size
|
22
|
-
|
23
|
-
return nil if @buf.size.zero?
|
24
|
-
return @buf.read(1)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Tells whether all the data has been both read from the passed buffer
|
28
|
-
# and from the internal cache buffer (checks whether there is anything that
|
29
|
-
# can be retreived using read_one_byte)
|
30
|
-
def data_exhausted?
|
31
|
-
@buf.eof? && @io.eof?
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def cache
|
37
|
-
data = @io.read(@bufsize)
|
38
|
-
@buf = StringIO.new(data.to_s) # Make nil become ""
|
39
|
-
end
|
40
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
3
|
-
|
4
|
-
class TestBufferingReader < Test::Unit::TestCase
|
5
|
-
def test_reads_once
|
6
|
-
s = StringIO.new("This is a string")
|
7
|
-
|
8
|
-
reader = Tracksperanto::BufferingReader.new(s)
|
9
|
-
assert_equal "T", reader.read_one_byte
|
10
|
-
assert_equal "h", reader.read_one_byte
|
11
|
-
assert !reader.data_exhausted?
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_reads_set_buffer_size
|
15
|
-
s = StringIO.new("abcd")
|
16
|
-
flexmock(s).should_receive(:read).with(4).once.and_return("abcd")
|
17
|
-
reader = Tracksperanto::BufferingReader.new(s, 4)
|
18
|
-
reader.read_one_byte
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_reads_in_64kb_chunks_by_default
|
22
|
-
s = StringIO.new("abcd")
|
23
|
-
flexmock(s).should_receive(:read).with(64 * 1024).once.and_return("abcd")
|
24
|
-
reader = Tracksperanto::BufferingReader.new(s)
|
25
|
-
reader.read_one_byte
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_eof_with_empty
|
29
|
-
s = StringIO.new
|
30
|
-
reader = Tracksperanto::BufferingReader.new(s)
|
31
|
-
assert s.eof?
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_eof_with_io_at_eof
|
35
|
-
s = StringIO.new("foo")
|
36
|
-
s.read(3)
|
37
|
-
reader = Tracksperanto::BufferingReader.new(s)
|
38
|
-
assert reader.data_exhausted?
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_eof_with_string_to_size
|
42
|
-
s = "Foobarboo another"
|
43
|
-
s = StringIO.new(s)
|
44
|
-
reader = Tracksperanto::BufferingReader.new(s, 1)
|
45
|
-
s.length.times { reader.read_one_byte }
|
46
|
-
assert reader.data_exhausted?
|
47
|
-
end
|
48
|
-
end
|