Sha256: 665e2ce6993eeb0466f9228a2b8e8c1a0f691ca8a8b818d8c484082606977028

Contents?: true

Size: 644 Bytes

Versions: 2

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.0")

    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

2 entries across 2 versions & 1 rubygems

Version Path
ffprober-0.2.2 lib/ffprober/ffprobe_version.rb
ffprober-0.2.1 lib/ffprober/ffprobe_version.rb