flame_channel_parser 4.0.2 → 4.2.0
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.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +6 -1
- data/Gemfile +4 -8
- data/History.txt +12 -0
- data/{README.rdoc → README.md} +33 -14
- data/Rakefile +3 -21
- data/bin/bake_flame_channel +1 -1
- data/bin/flame_channel_inspect +26 -0
- data/flame_channel_parser.gemspec +14 -116
- data/lib/builder.rb +3 -2
- data/lib/extractor.rb +2 -2
- data/lib/flame_channel_parser/version.rb +3 -0
- data/lib/flame_channel_parser.rb +5 -9
- data/lib/framecurve_writers/base.rb +6 -4
- data/lib/framecurve_writers/batch_timewarp.rb +3 -2
- data/lib/framecurve_writers/kronos.rb +3 -2
- data/lib/framecurve_writers/softfx_timewarp.rb +2 -1
- data/lib/inspector.rb +74 -0
- data/lib/interpolator.rb +1 -0
- data/lib/parser.rb +1 -0
- data/lib/segments.rb +2 -1
- data/lib/timewarp_extractor.rb +1 -0
- data/lib/xml_parser.rb +13 -18
- data/test/stabilizer_examples/2014_cornerpin_points.stabilizer +16835 -0
- data/test/test_flame_channel_parser.rb +0 -1
- data/test/test_inspector.rb +39 -0
- data/test/test_inspector_ref_output_stabilizer.txt +76 -0
- data/test/test_inspector_ref_output_timewarp.txt +10 -0
- data/test/test_interpolator.rb +11 -3
- data/test/test_ractor.rb +30 -0
- metadata +94 -41
data/lib/xml_parser.rb
CHANGED
|
@@ -2,16 +2,15 @@ require 'rexml/document'
|
|
|
2
2
|
require "rexml/streamlistener"
|
|
3
3
|
|
|
4
4
|
class FlameChannelParser::XMLParser < FlameChannelParser::Parser
|
|
5
|
-
# Here you can assign a logger proc or a lambda that will be call'ed with progress reports
|
|
6
|
-
attr_accessor :logger_proc
|
|
7
5
|
|
|
8
|
-
# A SAX-based translation layer
|
|
6
|
+
# A SAX-based translation layer for XML-based setups.
|
|
7
|
+
# It will listen for specific tag names and transform the XML
|
|
8
|
+
# format into the old-school tab-delimited text format as it goes
|
|
9
9
|
class XMLToSetup
|
|
10
10
|
include REXML::StreamListener
|
|
11
11
|
|
|
12
|
-
def initialize(
|
|
13
|
-
@
|
|
14
|
-
@indent = 0
|
|
12
|
+
def initialize(text_setup_destination_io)
|
|
13
|
+
@buffer = text_setup_destination_io
|
|
15
14
|
@in_channel = false
|
|
16
15
|
@path = []
|
|
17
16
|
end
|
|
@@ -35,10 +34,10 @@ class FlameChannelParser::XMLParser < FlameChannelParser::Parser
|
|
|
35
34
|
@in_channel = true
|
|
36
35
|
# Compose the full channel name
|
|
37
36
|
|
|
38
|
-
@
|
|
37
|
+
@buffer.puts("Channel %s" % channel_name)
|
|
39
38
|
elsif element == "Key"
|
|
40
39
|
@in_key = true
|
|
41
|
-
@
|
|
40
|
+
@buffer.puts("\tKey %d" % attributes["Index"].to_i)
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
|
|
@@ -50,20 +49,20 @@ class FlameChannelParser::XMLParser < FlameChannelParser::Parser
|
|
|
50
49
|
@path.pop
|
|
51
50
|
if element == "Channel"
|
|
52
51
|
@in_channel = false
|
|
53
|
-
@
|
|
52
|
+
@buffer.puts("\tEnd")
|
|
54
53
|
end
|
|
55
54
|
|
|
56
55
|
if element == "Key"
|
|
57
56
|
@in_key = false
|
|
58
|
-
@
|
|
57
|
+
@buffer.puts("\t\tEnd")
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
if @in_key
|
|
62
|
-
@
|
|
61
|
+
@buffer.puts("\t\t" + transfo(element) + " " + @text)
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
if !@in_key && @in_channel
|
|
66
|
-
@
|
|
65
|
+
@buffer.puts("\t" + transfo(element) + " " + @text)
|
|
67
66
|
end
|
|
68
67
|
end
|
|
69
68
|
|
|
@@ -74,17 +73,13 @@ class FlameChannelParser::XMLParser < FlameChannelParser::Parser
|
|
|
74
73
|
|
|
75
74
|
# Parses the setup passed in the IO. If a block is given to the method it will yield Channel
|
|
76
75
|
# objects one by one instead of accumulating them into an array (useful for big setups)
|
|
77
|
-
def parse(io)
|
|
76
|
+
def parse(io, &blk)
|
|
78
77
|
# Ok this is gothic BUT needed. What we do is we transform the XML setup into the OLD
|
|
79
78
|
# setup format, after which we run it through the OLD parser all the same.
|
|
80
79
|
# I am almost sure that ADSK does the same.
|
|
81
80
|
t = Tempfile.new("bx")
|
|
82
81
|
REXML::Document.parse_stream(io, XMLToSetup.new(t))
|
|
83
82
|
t.rewind
|
|
84
|
-
|
|
85
|
-
super(t, &Proc.new)
|
|
86
|
-
else
|
|
87
|
-
super(t)
|
|
88
|
-
end
|
|
83
|
+
super(t, &blk)
|
|
89
84
|
end
|
|
90
85
|
end
|