fest 1.4.12 → 1.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 971b8a6270186dc0400dd8c2831878d736b6a698
4
- data.tar.gz: 5000bd30c31c717c364ec41e100bcccae9a3c98e
3
+ metadata.gz: 53f68ffbc15a4a6966f6fcb94ce7574d62ca544d
4
+ data.tar.gz: e84ae4593be638f11355e4176e92940f6a2baeb9
5
5
  SHA512:
6
- metadata.gz: 66cc10e14ab3435990869502e7ad6cce79be50163bac163c05708c7739aa9fef1fe1b6fc8f1f99592e6f169ea46b7c26614388bebd5c3017a21ba9dd55e14c11
7
- data.tar.gz: 8f8233848deaa304ce77f950e276a0449ea421802cfb0849c5e6f75b5cd968b12f80520cb9334595096ef047d9902fde79197cf88c00b617b317a5ec59d5f7db
6
+ metadata.gz: b60e425906795bf19eaaafb1247731d783b3f638d13f0a8cdd9d6d696aafd953786068d36ba7a54e91531036e7e14367342291c8c4a290b90e4307d68a53112e
7
+ data.tar.gz: 0ef24eb74d9d1e5576c35ced977b9862572e4cb3f11128c0841c6019a76d45bc06165a8196449733b100f4bffb86520dc8f05dcbdf6dcb63a8502488809b0df3
data/README.md CHANGED
@@ -30,8 +30,7 @@ $ gem install fest
30
30
  require 'fest'
31
31
 
32
32
  @fest = Fest.new
33
- @fest.say("Пример")
34
- # => Say "Пример"
33
+ @fest.say("Пример") # => Say "Пример"
35
34
 
36
35
  @fest = Fest.new(YAML.load_file('../config/custom.yml'))
37
36
  @fest.say("This is an example")
@@ -39,21 +38,23 @@ require 'fest'
39
38
 
40
39
  # All options
41
40
  # params || default value
42
- params['path'] || "/tmp"
41
+ params['path'] || '/tmp'
42
+ params['flat_volumes'] || 'no' # need pulseaudio flat-volumes = no
43
43
  params['min_volume'] || 20
44
44
  params['max_volume'] || 60
45
45
  params['step'] || 4
46
46
  params['backlight'] || nil # disable check backlight
47
- params['language'] || "voice_msu_ru_nsh_clunits"
47
+ params['language'] || 'voice_msu_ru_nsh_clunits'
48
+ params['conditions'] || {} # eval config/conditions.yml
48
49
 
49
50
  ## Сustomization
50
51
 
51
52
  @fest.initialize(params = {})
52
- # check @current_volume
53
+ # check @common_volume
53
54
  # @path, @index, @min_volume, @max_volume ...
54
55
 
55
56
  @fest.check_conditions
56
- # eval config/conditions.yml
57
+ # eval config/conditions.yml if default conditions
57
58
 
58
59
  @fest.make_wav(text)
59
60
 
@@ -61,11 +62,7 @@ params['language'] || "voice_msu_ru_nsh_clunits"
61
62
  # wait if paplay active ...
62
63
 
63
64
  @fest.play_wav
64
- # @fest.check_optimal_volume (optimize min_volume and max_volume)
65
- # @fest.turn_down_volume (with @step)
66
- # @volume = @current_volume - @current_volume / 10 * @step
67
65
  # play wav ... with @optimize_volume
68
- # @fest.return_current_volume (with @step)
69
66
  # delete_wav
70
67
  ```
71
68
 
@@ -78,3 +75,11 @@ params['language'] || "voice_msu_ru_nsh_clunits"
78
75
  vlc.run --play-and-exit $*
79
76
  amixer set Master 30% > /dev/null 2>&1
80
77
  ```
78
+
79
+ or
80
+
81
+ ```.js
82
+ ; pulseaudio config
83
+
84
+ flat-volumes = no ; yes
85
+ ```
data/changelog.org CHANGED
@@ -1,3 +1,7 @@
1
+ ** 1.4.14 (Ср 14 окт 2015 13:34:03)
2
+ - fix optimize volume with flat_volumes ...
3
+ ** 1.4.13 (Ср 14 окт 2015 11:59:29)
4
+ - add flat_volumes ... and play with it ...
1
5
  ** 1.4.12 (Сб 03 окт 2015 13:08:17)
2
6
  - manage volumes on inputs ... down ... up ...
3
7
  - merge for default params with params ...
data/config/custom.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  path:
3
3
  '/tmp'
4
+ flat_volumes:
5
+ 'yes'
4
6
  common_volume:
5
7
  - "`amixer | grep -o '[0-9]*' | sed '5 ! d' `.to_i"
6
8
  index:
data/config/default.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  path:
3
3
  '/tmp'
4
+ flat_volumes:
5
+ 'no'
4
6
  common_volume:
5
7
  - "`amixer | grep -o '[0-9]*' | sed '5 ! d' `.to_i"
6
8
  index:
data/fest.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'fest'
3
- gem.version = '1.4.12'
3
+ gem.version = '1.4.14'
4
4
  gem.authors = 'Alexsey Ermolaev'
5
5
  gem.email = 'afay.zangetsu@gmail.com'
6
6
  gem.homepage = 'https://github.com/AfsmNGhr/fest'
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
 
18
18
  gem.extra_rdoc_files = ['License.org', 'README.md']
19
- gem.requirements = ['*nix* or OS X', 'Pulseaudio sound server',
20
- 'Festival snpeech engine', 'xbacklight']
19
+ gem.requirements = ['*nix* or OS X (pgrep tools)',
20
+ 'Pulseaudio sound server',
21
+ 'Festival speech engine']
21
22
  end
data/lib/fest/volume.rb CHANGED
@@ -16,15 +16,24 @@ module Volume
16
16
  end
17
17
 
18
18
  def optimize_volume
19
- @optimize_volume = (
20
- if @common_volume > @max_volume
21
- @max_volume
22
- elsif @common_volume < @min_volume
23
- @min_volume
19
+ case @flat_volumes
20
+ when 'yes'
21
+ if @common_volume > @max_volume
22
+ @max_volume
23
+ elsif @common_volume < @min_volume
24
+ @min_volume
25
+ else
26
+ @common_volume
27
+ end
24
28
  else
25
- @common_volume
29
+ if @common_volume > @max_volume
30
+ @max_volume
31
+ elsif @common_volume < @min_volume
32
+ @min_volume
33
+ else
34
+ 100
35
+ end
26
36
  end
27
- )
28
37
  end
29
38
 
30
39
  def change_volumes(volumes, break_volumes, step)
data/lib/fest.rb CHANGED
@@ -53,10 +53,9 @@ class Fest
53
53
  expect_if_paplay_now
54
54
  current_volumes_on_inputs
55
55
  volumes_for_inputs
56
- optimize_volume
57
56
  change_volumes(@current_volumes, @volumes, @step)
58
57
  system("paplay #{@path}/say_#{@index}.wav \
59
- --volume='#{@optimize_volume * 655}' > /dev/null 2>&1")
58
+ --volume='#{optimize_volume * 655}' > /dev/null 2>&1")
60
59
  change_volumes(@volumes, @current_volumes, @step)
61
60
  end
62
61
 
data/spec/fest_spec.rb CHANGED
@@ -56,6 +56,8 @@ RSpec.describe Fest do
56
56
  @fest.make_wav('Вы числ+яю энт ро+п+ии ю вселенной')
57
57
  @fest.play_wav
58
58
  expect($?.success?).to be_truthy
59
+ @fest.delete_wav
60
+ expect($?.success?).to be_truthy
59
61
  end
60
62
  end
61
63
  end
data/spec/volume_spec.rb CHANGED
@@ -3,13 +3,16 @@ require 'spec_helper'
3
3
 
4
4
  RSpec.describe Fest do
5
5
  describe '::Volume' do
6
- before(:each) do
6
+ before(:all) do
7
7
  @fest = Fest.new
8
8
  params = YAML.load_file("#{GEM_ROOT}/config/default.yml")
9
+ @flat_volumes = params['flat_volumes']
9
10
  @step = params['step']
10
11
  @common_volume = eval(params['common_volume'].join('; '))
11
12
  @max_volume = params['max_volume']
12
13
  @min_volume = params['min_volume']
14
+ @current_volumes = @fest.current_volumes_on_inputs
15
+ @volumes = @fest.volumes_for_inputs
13
16
  end
14
17
 
15
18
  it '.include? Volume' do
@@ -39,40 +42,48 @@ RSpec.describe Fest do
39
42
  end
40
43
 
41
44
  it '#optimize_volume' do
42
- if @common_volume > @max_volume
43
- expect(@fest.optimize_volume).to be < @common_volume
44
- elsif @common_volume < @min_volume
45
- expect(@fest.optimize_volume).to be > @common_volume
45
+ case @flat_volumes
46
+ when 'yes'
47
+ if @common_volume > @max_volume
48
+ expect(@fest.optimize_volume).to be < @common_volume
49
+ elsif @common_volume < @min_volume
50
+ expect(@fest.optimize_volume).to be > @common_volume
51
+ else
52
+ expect(@fest.optimize_volume).to eq(@common_volume)
53
+ end
46
54
  else
47
- expect(@fest.optimize_volume).to eq(@common_volume)
55
+ if @common_volume > @max_volume
56
+ expect(@fest.optimize_volume).to be < @common_volume
57
+ elsif @common_volume < @min_volume
58
+ expect(@fest.optimize_volume).to be > @common_volume
59
+ else
60
+ expect(@fest.optimize_volume).to eq(100)
61
+ end
48
62
  end
49
63
  end
50
64
 
51
65
  it '#change_volumes down' do
52
- @fest.change_volumes(
53
- @fest.current_volumes_on_inputs, @fest.volumes_for_inputs, @step)
66
+ @fest.change_volumes(@current_volumes, @volumes, @step)
54
67
 
55
68
  info = `pactl list sink-inputs`
56
69
  inputs = info.scan(/\A#|№(\d+)/).flatten
57
70
  volumes = info.scan(/\W+:\s\w+\W+\w+:\s\d+\s\/\s+(\d+)%/).flatten
58
71
  current_volumes = inputs.zip(volumes.map(&:to_i)).to_h
59
72
 
60
- @fest.volumes_for_inputs.each do |input, volume|
73
+ @volumes.each do |input, volume|
61
74
  expect(volume).to eq(current_volumes[input])
62
75
  end
63
76
  end
64
77
 
65
78
  it '#change_volumes up' do
66
- @fest.current_volumes_on_inputs
67
- @fest.change_volumes(
68
- @fest.volumes_for_inputs, @fest.current_volumes_on_inputs, @step)
79
+ @fest.change_volumes(@volumes, @current_volumes, @step)
69
80
 
70
81
  info = `pactl list sink-inputs`
71
82
  inputs = info.scan(/\A#|№(\d+)/).flatten
72
83
  volumes = info.scan(/\W+:\s\w+\W+\w+:\s\d+\s\/\s+(\d+)%/).flatten
73
84
  current_volumes = inputs.zip(volumes.map(&:to_i)).to_h
74
85
 
75
- @fest.current_volumes_on_inputs.each do |input, volume|
86
+ @current_volumes.each do |input, volume|
76
87
  expect(volume).to eq(current_volumes[input])
77
88
  end
78
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.12
4
+ version: 1.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexsey Ermolaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -85,10 +85,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements:
88
- - "*nix* or OS X"
88
+ - "*nix* or OS X (pgrep tools)"
89
89
  - Pulseaudio sound server
90
- - Festival snpeech engine
91
- - xbacklight
90
+ - Festival speech engine
92
91
  rubyforge_project:
93
92
  rubygems_version: 2.5.0
94
93
  signing_key: