class FilePipeline::FileOperations::ExifRecovery
A non-modifying FileOperation
that compares a file's Exif Metadata with that of a reference file and returns tags missing in the working file as captured data.
Used to recover Exif tags that were not preserved during e.g. a file conversion.
Public Class Methods
Returns a new instance.
Options¶ ↑
-
skip_tags
- Exif tags to be ignored during comparison.
The ExifManipulable
mixin defines a set of Exif tags that will always be ignored.
# File lib/file_pipeline/file_operations/default_operations/exif_recovery.rb, line 25 def initialize(**opts) defaults = { skip_tags: [] } super(opts, defaults) @options[:skip_tags] += ExifManipulable.file_tags end
Public Instance Methods
Returns the DROPPED_EXIF_DATA tag defined in CapturedDataTags
.
Instances of ExifRecovery
will capture any Exif tags and their values that are present in the reference file but missing in the working file.
# File lib/file_pipeline/file_operations/default_operations/exif_recovery.rb, line 35 def captured_data_tag CapturedDataTags::DROPPED_EXIF_DATA end
Instances of ExifRecovery
do not modify the working file.
# File lib/file_pipeline/file_operations/default_operations/exif_recovery.rb, line 40 def modifies? false end
Compares the Exif metadata of src_file
with that of original
and returns all tags that are present in original
but missing in src_file
.
# File lib/file_pipeline/file_operations/default_operations/exif_recovery.rb, line 47 def operation(src_file, _, original) original_exif, src_file_exif = read_exif original, src_file missing_exif_fields(src_file_exif, original_exif) end