Sha256: 4b7775dc651a0610fddc6b51a23a503e1e7a4224b58529c77b60b02de28dc8f4

Contents?: true

Size: 659 Bytes

Versions: 8

Compression:

Stored size: 659 Bytes

Contents

module Lolcommits
  class CaptureLinux < Capturer
    def capture
      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

      # 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
      FileUtils.mv(tmpdir + "/%08d.jpg" % frames, snapshot_location)
      FileUtils.rm_rf( tmpdir )
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lolcommits-0.4.0 lib/lolcommits/capture_linux.rb
lolcommits-0.4.0.pre2 lib/lolcommits/capture_linux.rb
lolcommits-0.4.0.pre1 lib/lolcommits/capture_linux.rb
lolcommits-0.3.4 lib/lolcommits/capture_linux.rb
lolcommits-0.3.3 lib/lolcommits/capture_linux.rb
lolcommits-0.3.2 lib/lolcommits/capture_linux.rb
lolcommits-0.3.2.pre1 lib/lolcommits/capture_linux.rb
lolcommits-0.3.1 lib/lolcommits/capture_linux.rb