Module: CheckInstalledMac

Defined in:
lib/check_installed_mac.rb

Overview

MPlayer OSX Extended instead of smplayer… ?

Class Method Summary collapse

Class Method Details

.check_for_installed(name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/check_installed_mac.rb', line 7

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