Sha256: 32bfe420daf568198b22e264d2cf0833ee1f6d5b2f7b323db13c2ec474c69fcd

Contents?: true

Size: 1.01 KB

Versions: 33

Compression:

Stored size: 1.01 KB

Contents

module Lolcommits
  class CaptureLinux < Capturer
    def capture
      debug "LinuxCapturer: making tmp directory"
      tmpdir = Dir.mktmpdir

      # There's no way to give a capture delay in mplayer, but a number of frame
      # I've found that 6 is a good value for me.
      frames = if capture_delay != 0 then capture_delay else 6 end

      debug "LinuxCapturer: calling out to mplayer to capture image"
      # mplayer's output is ugly and useless, let's throw it away
      _, r, _ = Open3.popen3("mplayer -vo jpeg:outdir=#{tmpdir} -frames #{frames} tv://")
      # looks like we still need to read the output for something to happen
      r.read

      # the below SHOULD tell FileUtils actions to post their output if we are in debug mode
      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

  end

end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
lolcommits-0.4.6 lib/lolcommits/capture_linux.rb
lolcommits-0.4.6.pre1 lib/lolcommits/capture_linux.rb
lolcommits-0.4.5 lib/lolcommits/capture_linux.rb
lolcommits-0.4.4 lib/lolcommits/capture_linux.rb
acmcommits-1.1.4 lib/lolcommits/capture_linux.rb
acmcommits-1.1.3 lib/lolcommits/capture_linux.rb
acmcommits-1.1.2 lib/lolcommits/capture_linux.rb
acmcommits-1.1.1 lib/lolcommits/capture_linux.rb
acmcommits-1.1.0 lib/lolcommits/capture_linux.rb
lolcommits-0.4.4pre1 lib/lolcommits/capture_linux.rb
acmcommits-1.0.17 lib/lolcommits/capture_linux.rb
acmcommits-1.0.16 lib/lolcommits/capture_linux.rb
acmcommits-1.0.15 lib/lolcommits/capture_linux.rb
acmcommits-1.0.14 lib/lolcommits/capture_linux.rb
acmcommits-1.0.13 lib/lolcommits/capture_linux.rb
acmcommits-1.0.12 lib/lolcommits/capture_linux.rb
acmcommits-1.0.10 lib/lolcommits/capture_linux.rb
acmcommits-1.0.9 lib/lolcommits/capture_linux.rb
acmcommits-1.0.8 lib/lolcommits/capture_linux.rb
acmcommits-1.0.7 lib/lolcommits/capture_linux.rb