lava-frame_compare 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lava/frame_compare.rb +4 -4
- data/lib/lava/session.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ffd63700ee531e8ef5b8b5ba3bc4282af54b297
|
4
|
+
data.tar.gz: d026dcf1332ad28154f2cecb2cfbf65fa44c7b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b46586c7b613b3ad1872dbba6ed3614d4eb8557d767e22f1a7245b99024eb6dd56f1e3ac1f7e09f70f99c438c8b067ffbc01d27a0a61b19e58edfe41488161
|
7
|
+
data.tar.gz: d8cd0cbc73c24a4432e4d1776c33e3b177de4a6af613e195dd903534c216a86061763b177ff3100478d8ce7618dc5c1114f3375e99ea294e725315dc2a98092b
|
data/lib/lava/frame_compare.rb
CHANGED
@@ -18,10 +18,10 @@ module Lava
|
|
18
18
|
|
19
19
|
raise "frame_capture lambda function required" if !args[:frame_capture] || args[:capture]
|
20
20
|
|
21
|
-
Lava::Session.new( :name
|
22
|
-
:frame_capture
|
23
|
-
:dir
|
24
|
-
:
|
21
|
+
Lava::Session.new( :name => args[:name],
|
22
|
+
:frame_capture => args[:frame_capture] || args[:capture],
|
23
|
+
:dir => args[:dir],
|
24
|
+
:audio_sampler => args[:audio_sampler] )
|
25
25
|
|
26
26
|
end
|
27
27
|
|
data/lib/lava/session.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rmagick'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'lava/sample'
|
3
4
|
|
4
5
|
module Lava
|
5
6
|
|
@@ -12,13 +13,14 @@ module Lava
|
|
12
13
|
# Main class for managing the capture sessions
|
13
14
|
class Session
|
14
15
|
|
15
|
-
attr_accessor :name, :dir, :samples, :frame_capture
|
16
|
+
attr_accessor :name, :dir, :samples, :frame_capture, :audio_sampler
|
16
17
|
|
17
18
|
# Initialize a capture session
|
18
19
|
def initialize( args = {} )
|
19
20
|
@name = args[:name] || Time.now.to_i
|
20
21
|
@dir = args[:dir] || "#{DEFAULT_TMP_DIR}/#{@name}"
|
21
22
|
@frame_capture = args[:frame_capture] or raise ArgumentError, 'Need to provide a lambda to the constructor'
|
23
|
+
@audio_sampler = args[:audio_sampler]
|
22
24
|
@samples = []
|
23
25
|
FileUtils.mkdir_p(@dir)
|
24
26
|
File.directory?(@dir) or raise "Couldn't create session directory for screen grabs"
|
@@ -33,10 +35,11 @@ module Lava
|
|
33
35
|
capture_time = Time.now
|
34
36
|
|
35
37
|
@frame_capture.call(file)
|
38
|
+
volume = @audio_sampler.call if @audio_sampler
|
36
39
|
|
37
40
|
File.exist? file or raise "Couldn't capture frame"
|
38
41
|
|
39
|
-
sample = Lava::Sample.new( :file => file, :time => capture_time, :last => samples.last )
|
42
|
+
sample = Lava::Sample.new( :file => file, :time => capture_time, :last => samples.last, :volume => volume )
|
40
43
|
samples << sample
|
41
44
|
sample
|
42
45
|
end
|