bin/tracksperanto in tracksperanto-1.6.8 vs bin/tracksperanto in tracksperanto-1.6.9
- old
+ new
@@ -86,12 +86,29 @@
STDERR.puts "No input file provided - should be the last argument"
puts parser
exit(-1)
end
+class Spinner
+ RING = ['|', '/', '-', '\\', '|', '/', '-', '\\']
+
+ def initialize
+ @counter = 0
+ @last_message_length = 0
+ end
+
+ def spin(percent, msg)
+ current = RING[(@counter += 1) % RING.length]
+ output = " [%s %d%%]" % [current, percent]
+ STDOUT.write(output + "\r" * output.length)
+ STDOUT.flush
+ end
+end
+
pipe = Tracksperanto::Pipeline::Base.new
-pipe.progress_block = lambda{|percent, msg| STDOUT.write(".") }
+pipe.progress_block = Spinner.new.method(:spin).to_proc
+
if sole_format
begin
pipe.exporters = [Tracksperanto::Export.const_get(sole_format)]
rescue NameError
STDERR.puts "Unknown exporter #{sole_format}. Available exporters: #{writers.join(", ")}"
@@ -108,6 +125,6 @@
reformat.height = reformat_h if reformat_h
shift.x_shift = x_shift
shift.y_shift = y_shift
prefix.prefix = set_prefix
end
-STDOUT.write("\n")
+STDOUT.puts("\rConverted #{pipe.converted_points} trackers with #{pipe.converted_keyframes} keys")
\ No newline at end of file