fest 1.4.12 → 1.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -10
- data/changelog.org +4 -0
- data/config/custom.yml +2 -0
- data/config/default.yml +2 -0
- data/fest.gemspec +4 -3
- data/lib/fest/volume.rb +16 -7
- data/lib/fest.rb +1 -2
- data/spec/fest_spec.rb +2 -0
- data/spec/volume_spec.rb +24 -13
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53f68ffbc15a4a6966f6fcb94ce7574d62ca544d
|
4
|
+
data.tar.gz: e84ae4593be638f11355e4176e92940f6a2baeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'] ||
|
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'] ||
|
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 @
|
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
data/config/default.yml
CHANGED
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.
|
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
|
20
|
-
'
|
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
|
-
@
|
20
|
-
|
21
|
-
@max_volume
|
22
|
-
|
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='#{
|
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
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(:
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
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
|
-
@
|
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.
|
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
|
-
@
|
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.
|
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-
|
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
|
91
|
-
- xbacklight
|
90
|
+
- Festival speech engine
|
92
91
|
rubyforge_project:
|
93
92
|
rubygems_version: 2.5.0
|
94
93
|
signing_key:
|