lib/pipeline/base.rb in tracksperanto-2.12.0 vs lib/pipeline/base.rb in tracksperanto-3.0.0

- old
+ new

@@ -29,14 +29,14 @@ end end # The base pipeline is the whole process of track conversion from start to finish. # The pipeline object organizes the import formats, scans them, - # applies the middlewares. Here's how a calling sequence for a pipeline looks like: + # applies the tools. Here's how a calling sequence for a pipeline looks like: # # pipe = Tracksperanto::Pipeline::Base.new - # pipe.middleware_tuples = ["Shift", {:x => 10}] + # pipe.tool_tuples = ["Shift", {:x => 10}] # pipe.progress_block = lambda{|percent, msg| puts("#{msg}..#{percent.to_i}%") } # pipe.run("/tmp/shakescript.shk", :width => 720, :height => 576) # # The pipeline will also automatically allocate output files with the right extensions # at the same place where the original file resides, @@ -62,25 +62,25 @@ # Assign an array of exporter classes to use them instead of the default "All" attr_accessor :exporters # Contains arrays of the form ["MiddewareName", {:param => value}] - attr_accessor :middleware_tuples + attr_accessor :tool_tuples def initialize(*any) super @ios = [] end - # Will scan the middleware_tuples attribute and create a processing chain. - # Middlewares will be instantiated and wrap each other, starting with the first one - def wrap_output_with_middlewares(output) - return output unless (middleware_tuples && middleware_tuples.any?) + # Will scan the tool_tuples attribute and create a processing chain. + # Tools will be instantiated and wrap each other, starting with the first one + def wrap_output_with_tools(output) + return output unless (tool_tuples && tool_tuples.any?) - middleware_tuples.reverse.inject(output) do | wrapped, (middleware_name, options) | - Tracksperanto.get_middleware(middleware_name).new(wrapped, options || {}) + tool_tuples.reverse.inject(output) do | wrapped, (tool_name, options) | + Tracksperanto.get_tool(tool_name).new(wrapped, options || {}) end end # Runs the whole pipeline. Accepts the following options # * width - The comp width, for the case that the format does not support auto size @@ -103,14 +103,14 @@ # Setup a multiplexer mux = setup_outputs_for(from_input_file_path) # Wrap it into a module that will prevent us from exporting invalid trackers - lint = Tracksperanto::Middleware::Lint.new(mux) + lint = Tracksperanto::Tool::Lint.new(mux) - # Setup middlewares - endpoint = wrap_output_with_middlewares(lint) + # Setup tools + endpoint = wrap_output_with_tools(lint) @converted_points, @converted_keyframes = run_export(read_data, importer, endpoint) end def report_progress(percent_complete, message) int_pct = percent_complete.to_f.floor # Prevent float overflow above 100 percent @@ -180,10 +180,10 @@ percent_per_tracker = (100.0 - percent_complete) / obuf.size # Use the width and height provided by the parser itself exporter.start_export(importer.width, importer.height) - # Now send each tracker through the middleware chain + # Now send each tracker through the tool chain obuf.each_with_index do | t, tracker_idx | kf_weight = percent_per_tracker / t.keyframes.length points += 1 exporter.start_tracker_segment(t.name)