Sha256: 315226ad7fe82686fb353139d81ff3e5b9dc36047fbd9358ce0107c6315025dc
Contents?: true
Size: 1.12 KB
Versions: 27
Compression:
Stored size: 1.12 KB
Contents
class CharacterizeJob < Hyrax::ApplicationJob queue_as Hyrax.config.ingest_queue_name # Characterizes the file at 'filepath' if available, otherwise, pulls a copy from the repository # and runs characterization on that file. # @param [FileSet] file_set # @param [String] file_id identifier for a Hydra::PCDM::File # @param [String, NilClass] filepath the cached file within the Hyrax.config.working_path def perform(file_set, file_id, filepath = nil) raise "#{file_set.class.characterization_proxy} was not found for FileSet #{file_set.id}" unless file_set.characterization_proxy? filepath = Hyrax::WorkingDirectory.find_or_retrieve(file_id, file_set.id) unless filepath && File.exist?(filepath) Hydra::Works::CharacterizationService.run(file_set.characterization_proxy, filepath) Rails.logger.debug "Ran characterization on #{file_set.characterization_proxy.id} (#{file_set.characterization_proxy.mime_type})" file_set.characterization_proxy.save! file_set.update_index file_set.parent&.in_collections&.each(&:update_index) CreateDerivativesJob.perform_later(file_set, file_id, filepath) end end
Version data entries
27 entries across 27 versions & 1 rubygems