Sha256: b71aa8bd86be8b1a429d1157b3ecd76b3f2b7ca60576f0fe6525ec941c4387bc

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

module Ffprober
  class FfprobeVersion
    @@version_regex = /^ffprobe version (\d+)\.?(\d+)\.?(|\d+)$/

    MIN_VERSION = Gem::Version.new("0.9.0")
    MAX_VERSION = Gem::Version.new("1.2.1")

    def self.valid?
      MIN_VERSION <= parsed_version && parsed_version <= MAX_VERSION
    end

    def self.parsed_version
      version = `#{Ffprober.path} -version`.match(@@version_regex)
      raise Errno::ENOENT  if version.nil?
      major, minor, patch = version[1].to_i, version[2].to_i, version[3].to_i
      Gem::Version.new([major, minor, patch].join("."))
    rescue Errno::ENOENT => e
      Gem::Version.new("0.0.0")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffprober-0.2.3 lib/ffprober/ffprobe_version.rb