Class: ValkyrieCreateDerivativesJob

Inherits:
Hyrax::ApplicationJob show all
Defined in:
app/jobs/valkyrie_create_derivatives_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(_file_set_id, file_id, _filepath = nil) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
# File 'app/jobs/valkyrie_create_derivatives_job.rb', line 4

def perform(_file_set_id, file_id, _filepath = nil)
   = Hyrax.custom_queries.(id: file_id)
  return if .video? && !Hyrax.config.enable_ffmpeg
  # Get file into a local path.
  file = Hyrax.storage_adapter.find_by(id: .file_identifier)
  # Call derivatives with the file_set.
  derivative_service = Hyrax::DerivativeService.for()
  derivative_service.create_derivatives(file.disk_path)
  # Trigger a reindex to get the thumbnail path.
  Hyrax.publisher.publish('file.metadata.updated', metadata: , user: nil)
end