Class: Lolcommits::CaptureLinux
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
Instance Method Details
#capture ⇒ Object
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
|
# File 'lib/lolcommits/capture_linux.rb', line 8
def capture
debug 'LinuxCapturer: making tmp directory'
tmpdir = Dir.mktmpdir
delay = if capture_delay != 0 then capture_delay else 1 end
frames = delay.to_i * 25
debug 'LinuxCapturer: calling out to mplayer to capture image'
_, r, _ = Open3.popen3("#{executable_path} -vo jpeg:outdir=#{tmpdir} #{capture_device_string} -frames #{frames} tv://")
r.read
include FileUtils::Verbose if logger.level == 0
debug 'LinuxCapturer: calling out to mplayer to capture image'
FileUtils.mv(tmpdir + '/%08d.jpg' % frames, snapshot_location)
debug 'LinuxCapturer: cleaning up'
FileUtils.rm_rf(tmpdir)
end
|
#capture_device_string ⇒ Object
4
5
6
|
# File 'lib/lolcommits/capture_linux.rb', line 4
def capture_device_string
@capture_device.nil? ? nil : "-tv device=\"#{@capture_device}\""
end
|
#executable_path ⇒ Object
35
36
37
|
# File 'lib/lolcommits/capture_linux.rb', line 35
def executable_path
'mplayer'
end
|