Class: CreateDerivativesJob

Inherits:
ActiveFedoraIdBasedJob show all
Defined in:
app/jobs/create_derivatives_job.rb

Instance Attribute Summary

Attributes inherited from ActiveFedoraIdBasedJob

#id

Instance Method Summary collapse

Methods inherited from ActiveFedoraIdBasedJob

#object

Instance Method Details

#parent_needs_reindex?Boolean

If this file_set is the thumbnail for the parent work, then the parent also needs to be reindexed.

Returns:

  • (Boolean)


16
17
18
19
# File 'app/jobs/create_derivatives_job.rb', line 16

def parent_needs_reindex?
  return false unless file_set.parent
  file_set.parent.thumbnail_id == file_set.id
end

#perform(id, file_name) ⇒ Object



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

def perform(id, file_name)
  @id = id
  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?
end