Class: Shingoncoder::Backend::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/shingoncoder/backend/job.rb

Class Method Summary collapse

Class Method Details

.create(options) ⇒ Integer

Register the job and kicks off several derivatives.

Parameters:

  • options (Hash)
  • [String] (Hash)

    a customizable set of options

Returns:

  • (Integer)

    :id for the job



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shingoncoder/backend/job.rb', line 8

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