Class: FilePipeline::FileOperations::ExifRecovery
- Inherits:
-
FileOperation
- Object
- FileOperation
- FilePipeline::FileOperations::ExifRecovery
- Includes:
- ExifManipulable
- Defined in:
- lib/file_pipeline/file_operations/default_operations/exif_recovery.rb
Overview
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.
Instance Attribute Summary
Attributes inherited from FileOperation
Instance Method Summary collapse
-
#captured_data_tag ⇒ Object
Returns the DROPPED_EXIF_DATA tag defined in CapturedDataTags.
-
#initialize(**opts) ⇒ ExifRecovery
constructor
:args: options.
-
#modifies? ⇒ Boolean
Instances of ExifRecovery do not modify the working file.
-
#operation(src_file, _, original) ⇒ Object
Compares the Exif metadata of
src_filewith that oforiginaland returns all tags that are present inoriginalbut missing insrc_file.
Methods included from ExifManipulable
#delete_tags, file_tags, #missing_exif_fields, #parse_exif_errors, parse_tag_error, #read_exif, strip_path, #write_exif
Methods inherited from FileOperation
#extension, #failure, #name, #results, #run, #success, #target, #target_extension
Constructor Details
#initialize(**opts) ⇒ ExifRecovery
:args: options
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.
25 26 27 28 29 |
# 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. end |
Instance Method Details
#captured_data_tag ⇒ Object
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.
35 36 37 |
# File 'lib/file_pipeline/file_operations/default_operations/exif_recovery.rb', line 35 def captured_data_tag CapturedDataTags::DROPPED_EXIF_DATA end |
#modifies? ⇒ Boolean
Instances of ExifRecovery do not modify the working file.
40 41 42 |
# File 'lib/file_pipeline/file_operations/default_operations/exif_recovery.rb', line 40 def modifies? false end |
#operation(src_file, _, original) ⇒ Object
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.
47 48 49 50 |
# 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 |