Sha256: 4f140ce1e47ee32924cbccd9aee7691b0ac47c59ca2d5f46fee9071751b2b83b

Contents?: true

Size: 1.41 KB

Versions: 22

Compression:

Stored size: 1.41 KB

Contents

require 'rubygems'
require 'os'
success = true

# MPlayer OSX Extended instead of smplayer... ?
module CheckInstalledMac
 def self.check_for_installed name
  if name == 'mencoder'
    output = `mencoder --fail 2>&1`
    if output =~ /mencoder/i
      # success, it is installed
      return true
    else
      # fall through
    end
  end

  if name == 'mplayer'
    for path in ["/Applications/MPlayerX.app/Contents/Resources/binaries/m32", File.expand_path('~') + "/Downloads/MPlayerX.app/Contents/Resources/binaries/m32/"]
      if File.exist? path + "/mplayer"
        ENV['PATH'] = path + ':' + ENV['PATH']
        return true
      end
    end
    puts 'lacking mplayer! please install MPlayerX from the App Store first'
    return false
  end

  # check for the others as generics

  command = {"gocr" => "gocr --help", "convert" => "convert --help", "ffmpeg" => "ffmpeg -version"}[name]

  raise 'unknown ' + name unless command # sanity check

  unless system(command + " 1> " + OS.dev_null + " 2>" + OS.dev_null)
     name = 'ImageMagick' if name == 'convert' # special case...
     puts 'lacking dependency! Please install ' + name + ' by installing macports and running in terminal: $ sudo port install ' + name
     false
  else
    true
  end

 end
end

if $0 == __FILE__
  for name in ['gocr', 'convert', 'mplayer', 'ffmpeg'] do
    if CheckInstalledMac.check_for_installed name
      puts 'has dep:' + name
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
sensible-cinema-0.28.1 lib/check_installed_mac.rb
sensible-cinema-0.28.0 lib/check_installed_mac.rb
sensible-cinema-0.27.0 lib/check_installed_mac.rb
sensible-cinema-0.26.3 lib/check_installed_mac.rb
sensible-cinema-0.26.2 lib/check_installed_mac.rb
sensible-cinema-0.26.1 lib/check_installed_mac.rb
sensible-cinema-0.26.0 lib/check_installed_mac.rb
sensible-cinema-0.25.4 lib/check_installed_mac.rb
sensible-cinema-0.25.3 lib/check_installed_mac.rb
sensible-cinema-0.25.2 lib/check_installed_mac.rb
sensible-cinema-0.25.1 lib/check_installed_mac.rb
sensible-cinema-0.25.0 lib/check_installed_mac.rb
sensible-cinema-0.24.9 lib/check_installed_mac.rb
sensible-cinema-0.24.8 lib/check_installed_mac.rb
sensible-cinema-0.24.7 lib/check_installed_mac.rb
sensible-cinema-0.24.6 lib/check_installed_mac.rb
sensible-cinema-0.24.5 lib/check_installed_mac.rb
sensible-cinema-0.24.4 lib/check_installed_mac.rb
sensible-cinema-0.24.3 lib/check_installed_mac.rb
sensible-cinema-0.24.2 lib/check_installed_mac.rb