app/jobs/characterize_job.rb in hyrax-3.0.0.pre.rc1 vs app/jobs/characterize_job.rb in hyrax-3.0.0.pre.rc2
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
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.
@@ -13,22 +14,21 @@
CreateDerivativesJob.perform_later(file_set, file_id, filepath)
end
private
- def characterize(file_set, _file_id, 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.alpha_channels = channels(filepath) if file_set.image? && Hyrax.config.iiif_image_server?
- file_set.characterization_proxy.save!
- file_set.update_index
- file_set.parent&.in_collections&.each(&:update_index)
- end
+ def characterize(file_set, _file_id, 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.alpha_channels = channels(filepath) if file_set.image? && Hyrax.config.iiif_image_server?
+ file_set.characterization_proxy.save!
+ file_set.update_index
+ end
- def channels(filepath)
- ch = MiniMagick::Tool::Identify.new do |cmd|
- cmd.format '%[channels]'
- cmd << filepath
- end
- [ch]
+ def channels(filepath)
+ ch = MiniMagick::Tool::Identify.new do |cmd|
+ cmd.format '%[channels]'
+ cmd << filepath
end
+ [ch]
+ end
end