lib/filentory/exifextractor.rb in filentory-cli-0.2.0 vs lib/filentory/exifextractor.rb in filentory-cli-0.3.0
- old
+ new
@@ -1,10 +1,11 @@
require 'exifr'
require 'xmp'
class ExifExtractor
+ # Extracts the metadata of a file at a given path in the file system.
def metadata_for_file(file_path)
img = EXIFR::JPEG.new(file_path)
xmpValues = Hash.new
@@ -15,9 +16,11 @@
xmpValues.delete_if { |k, v| v.nil? || v.to_s.empty?}
rescue => error
Hash.new
end
+ # Check if ExifExtractor handles the file extension.
+ # Example: ExifExtractor.handles? ".jpg" => returns true
def self.handles?(file_extension)
[".jpg", ".jpeg", ".tiff"].include? file_extension
end
private
\ No newline at end of file