Class: Hyrax::ActiveEncode::PersistActiveEncodeDerivatives

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/active_encode/persist_active_encode_derivatives.rb

Class Method Summary collapse

Class Method Details

.call(output, directives) ⇒ Object

Parameters:

  • output (ActiveEncode::Output)

    the output from the active_encode adapter

  • directives (Hash)

    directions which can be used to determine where to persist to.

Options Hash (directives):

  • local_streaming (String)

    flag for copying to Hyrax derivative directory

  • file_set_id (String)

    the id of the file set to add the derivative



10
11
12
13
14
15
16
17
18
# File 'app/services/hyrax/active_encode/persist_active_encode_derivatives.rb', line 10

def self.call(output, directives)
  file_set = ActiveFedora::Base.find(directives[:file_set_id])
  if directives[:local_streaming]
    old_url = output.url
    move_derivative(output, file_set)
    output.url = Hyrax::Engine.routes.url_helpers.download_path(file_set, file: File.basename(old_url))
  end
  create_pcdm_file(output, file_set)
end