bin/tracksperanto in tracksperanto-2.4.1 vs bin/tracksperanto in tracksperanto-2.5.0
- old
+ new
@@ -12,27 +12,12 @@
require File.dirname(__FILE__) + '/../lib/tracksperanto' unless defined?(Tracksperanto)
require 'optparse'
require 'rubygems'
require 'progressbar'
-require "net/http"
-require "open-uri"
-require "timeout"
-require File.dirname(__FILE__) + '/../lib/tracksperanto/pbar'
+require "update_hints"
-def version_check(version_present)
- begin
- version_info = open("http://rubygems.org/api/v1/gems/tracksperanto.xml").string.scan(/<version>(.+)<\/version>/).to_s
- int_available, int_present = [version_info, version_present].map{|v| v.scan(/(\d+)/).to_s.to_i }
- if int_available > int_present
- puts "Your version of Tracksperanto is probably out of date (the current version is #{version_info}, but you have #{Tracksperanto::VERSION})."
- puts "Please consider updating (run 'gem update tracksperanto')"
- end
- rescue Exception
- end
-end
-
def disclaimer
"Please consider a small donation to keep Tracksperanto going. http://guerilla-di.org/source-and-license/\n"+
"For information and support please contact info#{64.chr}guerilla-di.org"
end
@@ -49,19 +34,34 @@
v = value.nil? ? default_value : value
$middlewares.push([name, {option => v}])
end
end
+def list_exporters
+ puts "The following export modules are available:"
+ Tracksperanto.exporters.each do | exporter |
+ puts "\t#{exporter.const_name.downcase} - #{exporter.human_name}"
+ end
+end
+
+def list_importers
+ puts "The following import modules are available:"
+ Tracksperanto.importers.each do | importer |
+ puts "\t#{importer.const_name.downcase} - #{importer.human_name}"
+ end
+end
+
class CodeLoaded < RuntimeError; end
op.banner = "Usage: tracksperanto -f ShakeScript -w 1920 -h 1080 /Films/Blockbuster/Shots/001/script.shk"
op.on("--code PATH_TO_SCRIPT", String, "Load custom Ruby code into tracksperanto") do |c|
unless $code
require(c)
raise CodeLoaded
end
end
+
op.on(" -f", "--from TRANSLATOR", String, "Use the specific import translator") { |f| options[:importer] = f }
op.on(" -w", "--width WIDTH_IN_PIXELS", Integer, "Absolute input comp width in pixels (will try to autodetect)") { |w| options[:width] = w }
op.on(" -h", "--height HEIGHT_IN_PIXELS", Integer, "Absolute input comp height in pixels (will try to autodetect)") {|w| options[:height] = w }
op.on(" -o", "--only EXPORTER_NAME", String, "Only export the selected format, format must be one of #{writers.join(", ")}") { |f| writer_class_name = f }
@@ -76,16 +76,21 @@
op.on(" -ym", "--yshift Y_IN_PIXELS", Float, "Move the points up or down", &mw("Shift", :y_shift))
op.on(" -p", "--prefix PREFIX", String, "A prefix to prepend to tracker names in bulk", &mw("Prefix", :prefix))
op.on("--lerp", "Linearly interpolate missing keyframes", &mw("Lerp", :enabled, true))
op.on("--flip", "Flip the comp horizontally", &mw("Flip", :enabled, true))
op.on("--flop", "Flop the comp vertically", &mw("Flop", :enabled, true))
-
+op.on("--list-exporters", "Show available export modules") do
+ list_exporters; exit(0)
+end
+op.on("--list-importers", "Show available import modules") do
+ list_importers; exit(0)
+end
op.on("--version", "Show the version and exit") do |v|
puts "Tracksperanto v.#{Tracksperanto::VERSION} running on Ruby #{RUBY_VERSION} on #{RUBY_PLATFORM}"
puts "Copyright 2008-#{Time.now.year} by Guerilla-DI (Julik Tarkhanov and contributors)"
puts disclaimer
- version_check()
+ UpdateHints.version_check("tracksperanto", Tracksperanto::VERSION, STDOUT)
exit(0)
end
begin
op.parse!
@@ -103,13 +108,14 @@
unless File.exist?(input_file)
$stderr.puts "Input file #{input_file} does not exist"
exit(-1)
end
-pbar = Tracksperanto::PBar.new("Converting", 100, $stderr)
-pipe = Tracksperanto::Pipeline::Base.new(:progress_block => lambda{|p,m| pbar.set_with_message(p, m) }, :middleware_tuples => $middlewares)
+pbar = ProgressBar.new("Converting", 100, $stderr)
+progress = lambda{|percent,message| pbar.set(percent) }
+pipe = Tracksperanto::Pipeline::Base.new(:progress_block => progress, :middleware_tuples => $middlewares)
pipe.exporters = [Tracksperanto.get_exporter(writer_class_name)] if writer_class_name
pipe.run(input_file, options)
pbar.finish
puts disclaimer
-version_check(Tracksperanto::VERSION)
+UpdateHints.version_check("tracksperanto", Tracksperanto::VERSION, STDOUT)
\ No newline at end of file