Sha256: c44f6d6410595d37c691dd8ec4f4c4d0507295b8b205742e72197e66f086726e

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 Bytes

Contents

module Shingoncoder::Backend
  class Job
    class << self
      # Register the job and kicks off several derivatives.
      # @param [Hash] options
      # @option [String] :input the url to the file
      # @return [Integer] :id for the job
      def create(options)
        uri = URI(options.fetch(:input))
        filename = case uri.scheme
        when 'file'
          uri.path
        else
          raise ArgumentError, "#{uri.scheme} is not yet implemented"
        end

        job = Shingoncoder::Backend::JobRegistry.create(options)

        job.outputs.each do |output|
          TranscodeJob.perform_later(output.id)
        end

        job.id
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shingoncoder-0.0.2 lib/shingoncoder/backend/job.rb
shingoncoder-0.0.1 lib/shingoncoder/backend/job.rb