Sha256: b50c3937adfe3efc88ef8824a490fc1a4c73b2780c42ece508f84d3ca4b87db8

Contents?: true

Size: 837 Bytes

Versions: 6

Compression:

Stored size: 837 Bytes

Contents

class CreateDerivativesJob < ActiveJob::Base
  queue_as CurationConcerns.config.ingest_queue_name

  # @param [FileSet] file_set
  # @param [String] file_id identifier for a Hydra::PCDM::File
  def perform(file_set, file_id)
    return if file_set.video? && !CurationConcerns.config.enable_ffmpeg
    filename = CurationConcerns::WorkingDirectory.find_or_retrieve(file_id, file_set.id)

    file_set.create_derivatives(filename)
    # The thumbnail is indexed in the solr document, so reindex
    file_set.update_index
    file_set.parent.update_index if parent_needs_reindex?(file_set)
  end

  # If this file_set is the thumbnail for the parent work,
  # then the parent also needs to be reindexed.
  def parent_needs_reindex?(file_set)
    return false unless file_set.parent
    file_set.parent.thumbnail_id == file_set.id
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
curation_concerns-1.0.0 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta10 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta9 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta8 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta7 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta6 app/jobs/create_derivatives_job.rb