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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bebaac216dbc7938cdba61d15efeb72b3eff304c
4
- data.tar.gz: 1decd2d9f5c1d83a6cea886d5d493261438afdf9
3
+ metadata.gz: 1ffd63700ee531e8ef5b8b5ba3bc4282af54b297
4
+ data.tar.gz: d026dcf1332ad28154f2cecb2cfbf65fa44c7b1d
5
5
  SHA512:
6
- metadata.gz: 98176906cf5e8bd3ec9160f7c4659b2a5358d924f5a4f23ec493f6b8c01ae204a8e86909e627f9550f4d29e9bf6b002cbc96d305a8e7da4507e0e93a5988e860
7
- data.tar.gz: 96fa4c42137696775980098d743c8026c4a14985b5940ba0bca616a3bb79d05095a8d558a984241d9c6afbc62d137f54b0f3c4b0136353d6a08e042d90206d26
6
+ metadata.gz: 67b46586c7b613b3ad1872dbba6ed3614d4eb8557d767e22f1a7245b99024eb6dd56f1e3ac1f7e09f70f99c438c8b067ffbc01d27a0a61b19e58edfe41488161
7
+ data.tar.gz: d8cd0cbc73c24a4432e4d1776c33e3b177de4a6af613e195dd903534c216a86061763b177ff3100478d8ce7618dc5c1114f3375e99ea294e725315dc2a98092b
@@ -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 => args[:name],
22
- :frame_capture => args[:frame_capture] || args[:capture],
23
- :dir => args[:dir],
24
- :audio_sample => args[:audio_sample] )
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
 
@@ -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 #, :audio_sample
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lava-frame_compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - BBC