module MediaOrganizer::Image

Constants

SUPPORTED_FILETYPES

Public Class Methods

getJpegData(file) click to toggle source
# File lib/scrapers/image.rb, line 9
def Image.getJpegData(file)
        meta = EXIFR::JPEG.new(file)
        return meta.to_hash
        #!!! Rescue from common file-related and exifr-related errors here
end
getTiffData(file) click to toggle source
# File lib/scrapers/image.rb, line 15
def Image.getTiffData(file)
        meta = EXIFR::TIFF.new(file) 
        return meta.to_hash
        #!!! Rescue from common file-related and exifr-related errors here
end
is_image?(uri) click to toggle source
# File lib/scrapers/image.rb, line 25
def Image.is_image?(uri)
        unless !uri.nil? && uri.is_a?(String) && File.exists?(uri)
                raise FileNotFoundError, "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 21
def Image.supported_filetypes
        return SUPPORTED_FILETYPES           
end