Class: ActiveEncode::EngineAdapters::MatterhornAdapter
- Inherits:
-
Object
- Object
- ActiveEncode::EngineAdapters::MatterhornAdapter
- Defined in:
- lib/active_encode/engine_adapters/matterhorn_adapter.rb
Constant Summary collapse
- DEFAULT_ARGS =
{ 'flavor' => 'presenter/source' }.freeze
Instance Method Summary collapse
- #cancel(id) ⇒ Object
- #create(input_url, options = {}) ⇒ Object
- #find(id, opts = {}) ⇒ Object
- #list(*_filters) ⇒ Object
- #purge(encode) ⇒ Object
- #remove_output(encode, output_id) ⇒ Object
Instance Method Details
#cancel(id) ⇒ Object
26 27 28 29 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 26 def cancel(id) workflow_om = Rubyhorn.client.stop(id) build_encode(get_workflow(workflow_om)) end |
#create(input_url, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 8 def create(input_url, = {}) workflow_id = [:preset] || "full" # workflow_om = if encode.input.is_a? Hash # create_multiple_files(encode.input, workflow_id) # else workflow_om = Rubyhorn.client.addMediaPackageWithUrl(DEFAULT_ARGS.merge('workflow' => workflow_id, 'url' => input_url, 'filename' => File.basename(input_url), 'title' => File.basename(input_url))) # end build_encode(get_workflow(workflow_om)) end |
#find(id, opts = {}) ⇒ Object
18 19 20 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 18 def find(id, opts = {}) build_encode(fetch_workflow(id)) end |
#list(*_filters) ⇒ Object
22 23 24 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 22 def list(*_filters) raise NotImplementedError # TODO: implement this end |
#purge(encode) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 31 def purge(encode) workflow_om = begin Rubyhorn.client.stop(encode.id) rescue nil end workflow_om ||= begin Rubyhorn.client.get_stopped_workflow(encode.id) rescue nil end purged_workflow = purge_outputs(get_workflow(workflow_om)) # Rubyhorn.client.delete_instance(encode.id) #Delete is not working so workflow instances can always be retrieved later! build_encode(purged_workflow) end |
#remove_output(encode, output_id) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 47 def remove_output(encode, output_id) workflow = fetch_workflow(encode.id) output = encode.output.find { |o| o[:id] == output_id } return if output.nil? purge_output(workflow, output_id) output end |