module MediaOrganizer::Image

Constants

SUPPORTED_FILETYPES

Public Class Methods

get_jpeg_data(file) click to toggle source
# File lib/scrapers/image.rb, line 12
def self.get_jpeg_data(file)
  meta = EXIFR::JPEG.new(file)
  meta.to_hash
  # !!! Rescue from common file-related and exifr-related errors here
end
get_tiff_data(file) click to toggle source
# File lib/scrapers/image.rb, line 18
def self.get_tiff_data(file)
  meta = EXIFR::TIFF.new(file)
  meta.to_hash
  # !!! Rescue from common file-related and exifr-related errors here
end
image?(uri) click to toggle source
# File lib/scrapers/image.rb, line 28
def self.image?(uri)
  unless !uri.nil? && uri.is_a?(String) && File.exist?(uri)
    raise StandardError, "Directory given (#{uri}) could not be accessed."
  end

  if SUPPORTED_FILETYPES.include?(File.extname(uri).downcase)
    return true
  else
    return false
  end

rescue FileNotFoundError => e
  puts e.message
  puts e.backtrace.inspect
  return false
end
supported_filetypes() click to toggle source
# File lib/scrapers/image.rb, line 24
def self.supported_filetypes
  SUPPORTED_FILETYPES
end