app/jobs/characterize_job.rb in hyrax-4.0.0.beta1 vs app/jobs/characterize_job.rb in hyrax-4.0.0.beta2
- old
+ new
@@ -30,11 +30,15 @@
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?
# Ensure a fresh copy of the repo file's latest version is being worked on, if no filepath is directly provided
filepath = Hyrax::WorkingDirectory.copy_repository_resource_to_working_directory(Hydra::PCDM::File.find(file_id), file_set.id) unless filepath && File.exist?(filepath)
characterize(file_set, file_id, filepath)
- CreateDerivativesJob.perform_later(file_set, file_id, filepath)
+
+ Hyrax.publisher.publish('file.characterized',
+ file_set: file_set,
+ file_id: file_id,
+ path_hint: filepath)
end
private
def characterize(file_set, _file_id, filepath) # rubocop:disable Metrics/AbcSize
@@ -46,10 +50,10 @@
# If the current FileSet title is the same as the label, it must be a filename as opposed to a user-entered...
# value. So later we'll ensure it's set to the new file's filename.
reset_title = file_set.title.first == file_set.label
characterization_service.run(file_set.characterization_proxy, filepath)
- Rails.logger.debug "Ran characterization on #{file_set.characterization_proxy.id} (#{file_set.characterization_proxy.mime_type})"
+ Hyrax.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!
# Ensure that if the actual file content has changed, the mod timestamp on the FileSet object changes.
# Otherwise this does not happen when rolling back to a previous version. Perhaps this should be set as part of...