You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/services/rasterizer.rb

16 lines
403 B
Ruby

require 'open3'
class Rasterizer
BINARY_PATH = (Rails.root + "a2png" + "a2png.sh").to_s
def generate_image(asciicast_url, out_path, time, scale, theme)
o, e, t = Open3.capture3("#{BINARY_PATH} -s #{scale} -t #{theme} '#{asciicast_url}' '#{out_path}' #{time}")
if t.exitstatus != 0
raise RuntimeError, "Couldn't generate image from #{asciicast_url}:\n#{o}\n#{e}"
end
end
end