Sha256: 051fb869e5aeb7cd469d3094d36885cf374563539038ead989363b95ed7b3527
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# -*- encoding: binary -*- module VTools # job instance class Job attr_reader :video, :id # constructor def initialize config @id = self.object_id.to_i @config = validate config @video = Video.new @config.file end # execute job def execute # start callback Handler.exec :job_started, @video, @config.action result = @video.get_info # we always get info case @config.action when /^convert$/i result = @video.convert @config.setup # will return video when /^thumbs$/i result = @video.create_thumbs @config.setup # will return thumbs array end # final callbacks Handler.exec :job_finished, result, @video, @config.action result end # parse video options def validate options unless options.action =~ /^convert|thumbs|info$/ && options.file && !options.file.empty? raise ConfigError, "Invalid action (config: #{options.marshal_dump})" else return options if options.action =~ /^info$/ # empty set error raise ConfigError, "Configuration is empty" if !options.setup || options.setup.empty? end options end end # Job end # VTools
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vtools-0.0.1 | lib/vtools/job.rb |