Sha256: 51cc6346da9db27272335bdd2be58bd3f8dc088844e074dd8f92942a77e6a598

Contents?: true

Size: 718 Bytes

Versions: 4

Compression:

Stored size: 718 Bytes

Contents

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

  # @param [FileSet] file_set
  # @param [String] file_name
  def perform(file_set, file_name)
    return if file_set.video? && !CurationConcerns.config.enable_ffmpeg

    file_set.create_derivatives(file_name)
    # 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

4 entries across 4 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta5 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta4 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta3 app/jobs/create_derivatives_job.rb
curation_concerns-1.0.0.beta2 app/jobs/create_derivatives_job.rb