module Pecari::Player
Public Class Methods
exit()
click to toggle source
# File lib/pecari/player.rb, line 43 def self.exit Pecari::PidKiller.kill_all_omx_processes end
launch(video)
click to toggle source
# File lib/pecari/player.rb, line 5 def self.launch(video) check_dependencies command = "#{Pecari::Env.display} && xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi '#{video}' &" fork do exec command end end
play_pause()
click to toggle source
# File lib/pecari/player.rb, line 13 def self.play_pause check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key p` end
quit()
click to toggle source
# File lib/pecari/player.rb, line 18 def self.quit check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key q` end
seek_backward()
click to toggle source
# File lib/pecari/player.rb, line 38 def self.seek_backward check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key Left` end
seek_forward()
click to toggle source
# File lib/pecari/player.rb, line 33 def self.seek_forward check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key Right` end
volume_down()
click to toggle source
# File lib/pecari/player.rb, line 28 def self.volume_down check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key minus` end
volume_up()
click to toggle source
# File lib/pecari/player.rb, line 23 def self.volume_up check_dependencies `#{Pecari::Env.display} && xdotool windowactivate #{omx_window} && xdotool key plus` end
Private Class Methods
check_dependencies()
click to toggle source
# File lib/pecari/player.rb, line 53 def self.check_dependencies raise UnavailableXDoToolError unless xdotool_installed? raise UnavailableOMXPlayerError unless omxplayer_installed? end
omx_window()
click to toggle source
# File lib/pecari/player.rb, line 49 def self.omx_window Pecari::WindowInfo.omx_info end
omxplayer_installed?()
click to toggle source
# File lib/pecari/player.rb, line 62 def self.omxplayer_installed? Pecari::Env.package_installed?('omxplayer') end
xdotool_installed?()
click to toggle source
# File lib/pecari/player.rb, line 58 def self.xdotool_installed? Pecari::Env.package_installed?('xdotool') end