Class: Lolcommits::CaptureWindows

Inherits:
Capturer
  • Object
show all
Defined in:
lib/lolcommits/capture_windows.rb

Instance Attribute Summary

Attributes inherited from Capturer

#animated_duration, #capture_delay, #capture_device, #font, #frames_location, #snapshot_location, #video_location

Instance Method Summary collapse

Methods inherited from Capturer

#initialize

Constructor Details

This class inherits a constructor from Lolcommits::Capturer

Instance Method Details

#captureObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/lolcommits/capture_windows.rb', line 3

def capture
  commandcam_exe = File.join Configuration::LOLCOMMITS_ROOT, "vendor", "ext", "CommandCam", "CommandCam.exe"
  # DirectShow takes a while to show... at least for me anyway
  delaycmd = " /delay 3000"
  if capture_delay > 0
    # CommandCam delay is in milliseconds
    delaycmd = " /delay #{capture_delay * 1000}"
  end

  _, r, _ = Open3.popen3("#{commandcam_exe} /filename #{snapshot_location}#{delaycmd}")

  # looks like we still need to read the output for something to happen
  r.read
end