class MediaInformationGatherer::ExifTool
Constants
- DEFAULT_EXECUTABLE_PATH
Public Class Methods
new(options = { })
click to toggle source
# File lib/mig/modules/exiftool.rb, line 9 def initialize(options = { }) #@logger = options[:logger] || Logger.new(STDOUT) @exiftool_cmd_path = options.fetch(:exiftool_cmd_path, DEFAULT_EXECUTABLE_PATH) end
Public Instance Methods
run(file_path, options = {})
click to toggle source
@param [String] file_path @param [Hash] options
# File lib/mig/modules/exiftool.rb, line 16 def run(file_path, options = {}) cmd_line = [@exiftool_cmd_path, '-json', file_path].shelljoin #@logger.debug { "[ExifTool] Executing command: #{cmd_line}" } metadata_json = %x(#{cmd_line}) #@logger.debug { "[ExifTool] Result: #{metadata_json}" } JSON.parse(metadata_json)[0] end