class HandBrake
Public Instance Methods
encode(input, output, opts = {})
click to toggle source
# File lib/cli_chef/apps/hand_brake.rb, line 17 def encode(input, output, opts = {}) run(opts.merge(input: input, output: output)) do |line, stream, job| job.task_count = line.scan(/(?<=of )\d+/).first.to_i job.task = line.scan(/\d+(?= of)/).first.to_i job.fps = line.scan(/\d+\.\d+(?= fps)/).first.to_f job.average_fps = line.scan(/(?<=avg )\d+\.\d+(?= fps)/).first.to_f job.eta = line.scan(/(?<=ETA ).*?(?=\))/).first.parse_duration rescue nil percent = line.scan(/\d+\.\d+(?= %)/).first.to_f if line.include?('Encode done!') percent = 100.0 elsif job.task_count > 2 && percent > 0 percent /= job.task_count percent += 50 * job.task end job.percent = percent unless percent < job.percent.to_i end end
help()
click to toggle source
# File lib/cli_chef/apps/hand_brake.rb, line 9 def help run!(help: nil).body end
version()
click to toggle source
# File lib/cli_chef/apps/hand_brake.rb, line 13 def version run!(version: nil).body.scan(/(?<=HandBrake\s)\d+\.\d+\.\d+/i).first end