lib/pipeline/base.rb in tracksperanto-2.6.3 vs lib/pipeline/base.rb in tracksperanto-2.7.0

- old
+ new

@@ -18,11 +18,12 @@ "Wrong import format maybe?\n" + "Note that PFTrack will only export trackers from the solved segment of the shot."; 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, + # 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: # # pipe = Tracksperanto::Pipeline::Base.new # pipe.middleware_tuples = ["Golden", {:enabled => true}] # pipe.progress_block = lambda{|percent, msg| puts("#{msg}..#{percent.to_i}%") } @@ -155,21 +156,20 @@ progress_lambda.call("Parsing the file") if (percent_complete - last_reported_percentage) > 3 end @ios.push(io_with_progress) - @accumulator = Tracksperanto::Accumulator.new + @accumulator = Obuf.new begin - # OBSOLETE - for this version we are going to permit it. - if importer.respond_to?(:stream_parse) + if importer.respond_to?(:each) + importer.io = io_with_progress + importer.each {|t| @accumulator.push(t) unless t.empty? } + else # OBSOLETE - for this version we are going to permit it. STDERR.puts "Import::Base#stream_parse(io) is obsolete, please rewrite your importer to use each instead" importer.receiver = @accumulator importer.stream_parse(io_with_progress) - else - importer.io = io_with_progress - importer.each {|t| @accumulator.push(t) unless t.empty? } end report_progress(percent_complete = 50.0, "Validating #{@accumulator.size} imported trackers") raise NoTrackersRecoveredError if @accumulator.size.zero? \ No newline at end of file