tracksperanto 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/tracksperanto CHANGED
@@ -63,7 +63,7 @@ if !input_file
63
63
  exit(-1)
64
64
  end
65
65
 
66
- pipe = Tracksperanto::Pipeline.new
66
+ pipe = Tracksperanto::Pipeline::Base.new
67
67
  pipe.run(input_file, width, height, reader_klass) do | scaler, slipper, golden |
68
68
  slipper.slip = slip
69
69
  scaler.x_factor = scale_x
data/lib/export/base.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # Base exporter
2
2
  class Tracksperanto::Export::Base
3
+ attr_reader :io
3
4
 
4
5
  def self.inherited(by)
5
6
  Tracksperanto.exporters << by
data/lib/pipeline.rb CHANGED
@@ -1,54 +0,0 @@
1
- class Tracksperanto::Pipeline
2
- attr_accessor :converted_points
3
- attr_accessor :converted_keyframes
4
- def run(from_input_file, pix_w, pix_h, parser_class)
5
- # Read the input file
6
- read_data = File.read(from_input_file)
7
- file_name = File.basename(from_input_file).gsub(/\.([^\.]+)$/, '')
8
-
9
- # Assign the parser
10
- parser = parser_class.new
11
- parser.width = pix_w
12
- parser.height = pix_h
13
-
14
- # Setup a multiplexer
15
- mux = Tracksperanto::Export::Mux.new(
16
- Tracksperanto.exporters.map do | exporter_class |
17
- export_name = "%s_%s" % [file_name, exporter_class.desc_and_extension]
18
- outfile = File.dirname(from_input_file) + '/' + export_name
19
- io = File.open(outfile, 'w')
20
- exporter_class.new(io)
21
- end
22
- )
23
-
24
- # Setup middlewares - skip for now
25
- scaler = Tracksperanto::Middleware::Scaler.new(mux)
26
- slipper = Tracksperanto::Middleware::Slipper.new(scaler)
27
- golden = Tracksperanto::Middleware::Golden.new(slipper)
28
-
29
- yield(scaler, slipper, golden) if block_given?
30
-
31
- processor = golden
32
-
33
- # Run the export
34
- trackers = parser.parse(read_data)
35
- processor.start_export(parser.width, parser.height)
36
- trackers.each do | t |
37
-
38
- @converted_points ||= 0
39
- @converted_points += 1
40
-
41
- processor.start_tracker_segment(t.name)
42
- t.keyframes.each do | kf |
43
-
44
- @converted_keyframes ||= 0
45
- @converted_keyframes += 1
46
-
47
- processor.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual)
48
- end
49
- end
50
-
51
- processor.end_export
52
- end
53
- end
54
-
data/lib/tracksperanto.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module Tracksperanto
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
 
4
4
  module Import; end
5
5
  module Export; end
6
6
  module Middleware; end
7
+ module Pipeline; end
7
8
 
8
9
  class << self
9
10
  # Returns the array of all exporter classes defined
@@ -128,4 +129,9 @@ end
128
129
  # Load middleware
129
130
  Dir.glob(File.dirname(__FILE__) + '/middleware/*.rb').each do | i |
130
131
  require i
132
+ end
133
+
134
+ # Load pipelines
135
+ Dir.glob(File.dirname(__FILE__) + '/pipeline/*.rb').each do | i |
136
+ require i
131
137
  end
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov