Sha256: 0cdca458e298a770a8d3f5fa8693d7de0ef5d9c8784b481de1a03386ac1162b9
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require 'logger' # IMPORTANT NOTE ffmprb uses threads internally, however, it is not "thread-safe" module Ffmprb ENV_VAR_FALSE_REGEX = /^(0|no?|false)?$/i CGA = '320x200' QVGA = '320x240' HD_720p = '1280x720' HD_1080p = '1920x1080' class Error < StandardError; end class << self # NOTE the form with the block returns the result of #run # NOTE the form without the block returns the process (before it is run) - advanced use # XXX is this clear enough? Do we really need the second form? def process(*args, &blk) logger.debug "Starting process with #{args} in #{blk.source_location}" process = Process.new return process unless blk process.instance_exec *args, &blk logger.debug "Initialized process with #{args} in #{blk.source_location}" process.run.tap do logger.debug "Finished process with #{args} in #{blk.source_location}" end end alias :action! :process # ;) attr_accessor :debug def logger @logger ||= Logger.new(STDERR).tap do |logger| logger.level = debug ? Logger::DEBUG : Logger::INFO end end def logger=(logger) @logger.close if @logger @logger = logger end end end Ffmprb.debug = ENV.fetch('FFMPRB_DEBUG', '') !~ Ffmprb::ENV_VAR_FALSE_REGEX Dir["#{__FILE__.slice /(.*).rb$/, 1}/**/*.rb"].each{|f| require f} # XXX require_sub __FILE__ # or something require 'defaults'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffmprb-0.7.5 | lib/ffmprb.rb |
ffmprb-0.7.4 | lib/ffmprb.rb |
ffmprb-0.7.3 | lib/ffmprb.rb |