fest 1.2.10 → 1.3.10
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 +4 -4
- data/.rspec +3 -0
- data/.travis.yml +4 -2
- data/README.md +9 -24
- data/Rakefile +8 -2
- data/changelog.org +6 -0
- data/config/conditions.yml +7 -0
- data/config/default.yml +20 -0
- data/fest.gemspec +4 -4
- data/lib/fest/volume.rb +6 -17
- data/lib/fest.rb +28 -32
- data/spec/fest_spec.rb +61 -0
- data/spec/params/custom_spec.rb +20 -0
- data/spec/params/default_spec.rb +20 -0
- metadata +19 -16
- data/lib/fest/conditions.rb +0 -19
- data/lib/fest/params.rb +0 -32
- data/spec/custom_params_spec.rb +0 -41
- data/spec/default_params_spec.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162120a716861b8e7afe36ae975895af52eee799
|
4
|
+
data.tar.gz: ce28d4db581b858d5165640155388073edcbaa82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34fed53a50413d0484681508ba00d25f8c1c00283f21fbeb2abff3c06a062c35585971647bb6efc0b181b751309d0c0b99d650809a9550c8e36cbbc9a0b36b2c
|
7
|
+
data.tar.gz: aab8528a178264dff0bb486670e8bc208ce90ac9e201d23cd149d6fdcfa758232e4e74bf06a93c8b5eaaf9347ae7fea786cb933a5e0e067f3f292d84307faad0
|
data/.rspec
ADDED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -34,42 +34,27 @@ require 'fest'
|
|
34
34
|
@fest.say("Пример")
|
35
35
|
# => Say "Пример"
|
36
36
|
|
37
|
-
|
38
|
-
@fest.params = {:language => "cmu_us_slt_arctic_hts"}
|
37
|
+
@fest = Fest.new({'language' => "cmu_us_slt_arctic_hts"})
|
39
38
|
@fest.say("This is an example")
|
40
39
|
# => Say "This is an example"
|
41
40
|
|
42
41
|
# All options
|
43
42
|
# params || default value
|
44
|
-
params[
|
45
|
-
params[
|
46
|
-
params[
|
47
|
-
params[
|
48
|
-
params[
|
49
|
-
params[
|
50
|
-
|
51
|
-
# Declension
|
52
|
-
text = @fest.pluraform(2, %w(Сообщение Сообщения Сообщений))
|
53
|
-
puts text
|
54
|
-
# => "Сообщения"
|
55
|
-
```
|
43
|
+
params['path'] || "/tmp"
|
44
|
+
params['min_volume'] || 20
|
45
|
+
params['max_volume'] || 60
|
46
|
+
params['step'] || 4
|
47
|
+
params['backlight'] || nil # disable check backlight
|
48
|
+
params['language'] || "voice_msu_ru_nsh_clunits"
|
56
49
|
|
57
50
|
## Сustomization
|
58
51
|
|
59
|
-
|
60
|
-
@fest.init(params)
|
52
|
+
@fest.initialize(params = {})
|
61
53
|
# check @current_volume
|
62
54
|
# @path, @index, @min_volume, @max_volume ...
|
63
55
|
|
64
56
|
@fest.check_conditions
|
65
|
-
#
|
66
|
-
# check_light и check_home_theater
|
67
|
-
|
68
|
-
@fest.check_light # (with xbacklight)
|
69
|
-
# exit if backlight equal 0
|
70
|
-
|
71
|
-
@fest.check_home_theater
|
72
|
-
# exit if run (vlc, kodi(xbmc))
|
57
|
+
# eval config/conditions.yml
|
73
58
|
|
74
59
|
@fest.make_wav(text)
|
75
60
|
|
data/Rakefile
CHANGED
@@ -10,5 +10,11 @@ rescue Bundler::BundlerError => e
|
|
10
10
|
end
|
11
11
|
|
12
12
|
require 'rspec/core/rake_task'
|
13
|
-
RSpec::Core::RakeTask.new(:spec)
|
14
|
-
|
13
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
14
|
+
file_list = FileList['spec/**/*_spec.rb']
|
15
|
+
file_list -= ['spec/fest_spec.rb',
|
16
|
+
'spec/volume_spec.rb']
|
17
|
+
task.pattern = file_list
|
18
|
+
end
|
19
|
+
|
20
|
+
task default: :spec
|
data/changelog.org
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
** 1.3.10 (2015-28-09 Пн)
|
2
|
+
- initialize with params for yml file
|
3
|
+
- check conditions @params['conditions'] or conditions.yml
|
4
|
+
- delete module conditions
|
5
|
+
- delete pluraform ...
|
6
|
+
- delete accessor params ...
|
1
7
|
** 1.2.10 (2015-03-11 Ср)
|
2
8
|
- say without params
|
3
9
|
- attr_accessor params
|
data/config/default.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
path:
|
3
|
+
'/tmp'
|
4
|
+
current_volume:
|
5
|
+
- "`amixer | grep -o '[0-9]*' | sed '5 ! d' `.to_i"
|
6
|
+
index:
|
7
|
+
- "index = `ls -r #{@path} | grep -o '[0-9]*' | sed '1 ! d'`.to_i"
|
8
|
+
- "index > 0 ? index += 1 : index = 1"
|
9
|
+
min_volume:
|
10
|
+
20
|
11
|
+
max_volume:
|
12
|
+
60
|
13
|
+
step:
|
14
|
+
4
|
15
|
+
language:
|
16
|
+
'voice_msu_ru_nsh_clunits'
|
17
|
+
backlight:
|
18
|
+
nil
|
19
|
+
conditions:
|
20
|
+
{}
|
data/fest.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'fest'
|
3
|
-
gem.version = '1.
|
3
|
+
gem.version = '1.3.10'
|
4
4
|
gem.authors = 'Alexsey Ermolaev'
|
5
5
|
gem.email = 'afay.zangetsu@gmail.com'
|
6
6
|
gem.homepage = 'https://github.com/AfsmNGhr/fest'
|
@@ -8,11 +8,11 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = 'Ruby wrapper for festival speech engine'
|
9
9
|
gem.license = 'MIT'
|
10
10
|
|
11
|
-
gem.add_development_dependency 'rake', '~>
|
12
|
-
gem.add_development_dependency 'rspec', '3.
|
11
|
+
gem.add_development_dependency 'rake', '~> 10.4'
|
12
|
+
gem.add_development_dependency 'rspec', '~> 3.3'
|
13
13
|
|
14
14
|
gem.files = `git ls-files`.split("\n")
|
15
|
-
gem.require_paths = ['lib']
|
15
|
+
gem.require_paths = ['lib', 'config']
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
|
18
18
|
gem.extra_rdoc_files = ['License.org', 'README.md']
|
data/lib/fest/volume.rb
CHANGED
@@ -17,28 +17,17 @@ module Volume
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
@inputs = `pactl list sink-inputs | grep № | grep -o '[0-9]*'`.split("\n")
|
20
|
+
def sink_inputs
|
21
|
+
@inputs = `pactl list sink-inputs | grep '№' | grep -o '[0-9]*'`.split("\n")
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def change_volume(volume, break_volume, step)
|
25
|
+
change = volume > break_volume ? 'down' : 'up'
|
25
26
|
@inputs.each do |input|
|
26
|
-
volume = @current_volume
|
27
27
|
loop do
|
28
28
|
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
29
|
-
volume -=
|
30
|
-
break if volume <
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def return_current_volume
|
36
|
-
@inputs.each do |input|
|
37
|
-
volume = @volume
|
38
|
-
loop do
|
39
|
-
system("pactl set-sink-input-volume #{input} '#{volume * 655}'")
|
40
|
-
volume += @step
|
41
|
-
break if volume > @current_volume
|
29
|
+
change == 'up' ? volume += step : volume -= step
|
30
|
+
break if change == 'up' ? volume > break_volume : volume < break_volume
|
42
31
|
end
|
43
32
|
end
|
44
33
|
end
|
data/lib/fest.rb
CHANGED
@@ -2,33 +2,38 @@
|
|
2
2
|
# Ruby wrapper for Festival speech engine
|
3
3
|
# author Alexsey Ermolaev afay.zangetsu@gmail.com
|
4
4
|
|
5
|
-
|
5
|
+
require 'bundler'
|
6
|
+
GEM_ROOT = Bundler.rubygems.find_name('fest').first.full_gem_path
|
6
7
|
require_relative './fest/volume'
|
7
|
-
|
8
|
-
|
8
|
+
require 'yaml'
|
9
|
+
|
9
10
|
class Fest
|
10
|
-
include Params
|
11
11
|
include Volume
|
12
|
-
include Conditions
|
13
|
-
attr_accessor :params
|
14
12
|
|
15
13
|
def say(string)
|
16
|
-
init
|
17
14
|
check_conditions
|
18
15
|
make_wav(string)
|
19
16
|
expect_if_paplay_now
|
20
17
|
play_wav
|
21
18
|
end
|
22
19
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
def initialize(params = {})
|
21
|
+
params =
|
22
|
+
YAML.load_file("#{GEM_ROOT}/config/default.yml") if params == {}
|
23
|
+
params.each do |key, value|
|
24
|
+
instance_variable_set(
|
25
|
+
"@#{key}",
|
26
|
+
value.is_a?(Array) ? eval(value.join('; ')) : value
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def check_conditions
|
32
|
+
@conditions =
|
33
|
+
YAML.load_file("#{GEM_ROOT}/config/conditions.yml") if @conditions == {}
|
34
|
+
@conditions.values.each do |value|
|
35
|
+
eval(value.join('; '))
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
def make_wav(string)
|
@@ -46,26 +51,17 @@ class Fest
|
|
46
51
|
def play_wav
|
47
52
|
check_optimal_volume
|
48
53
|
optimize_volume
|
49
|
-
|
50
|
-
|
54
|
+
sink_inputs
|
55
|
+
change_volume(@current_volume, @volume, @step)
|
51
56
|
system("paplay #{@path}/say_#{@index}.wav \
|
52
57
|
--volume='#{@optimize_volume * 655}' > /dev/null 2>&1")
|
53
|
-
|
54
|
-
|
58
|
+
change_volume(@volume, @current_volume, @step)
|
59
|
+
delete_wav
|
55
60
|
end
|
56
61
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
if n > 10 && n < 20
|
62
|
-
array[2]
|
63
|
-
elsif m > 1 && m < 5
|
64
|
-
array[1]
|
65
|
-
elsif m == 1
|
66
|
-
array[0]
|
67
|
-
else
|
68
|
-
array[2]
|
62
|
+
def delete_wav
|
63
|
+
if File.exist?("#{@path}/say_#{@index}.wav")
|
64
|
+
File.delete("#{@path}/say_#{@index}.wav")
|
69
65
|
end
|
70
66
|
end
|
71
67
|
end
|
data/spec/fest_spec.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Fest do
|
5
|
+
before(:each) do
|
6
|
+
@fest = Fest.new
|
7
|
+
params = YAML.load_file("#{GEM_ROOT}/config/default.yml")
|
8
|
+
@index = params['index']
|
9
|
+
@path = params['path']
|
10
|
+
end
|
11
|
+
|
12
|
+
context '#say' do
|
13
|
+
it 'check successfull say' do
|
14
|
+
@fest.say('Начинаю тъэ+с т+ирова ние')
|
15
|
+
expect($?.success?).to be_truthy
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context '#make_wav' do
|
20
|
+
it 'successfull make wav?' do
|
21
|
+
@fest.make_wav('Пример')
|
22
|
+
expect($?.success?).to be_truthy
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'pid not eq latest' do
|
26
|
+
pid = $?.pid
|
27
|
+
@fest.make_wav('Пример')
|
28
|
+
expect(pid).not_to eq($?.pid)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'index change after make wav' do
|
32
|
+
i = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
33
|
+
@fest.make_wav('Пример')
|
34
|
+
expect(@index).not_to eq(i)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context '#delete_wav' do
|
39
|
+
it 'with successfull?' do
|
40
|
+
@fest.make_wav('Пример')
|
41
|
+
@fest.delete_wav
|
42
|
+
expect($?.success?).to be_truthy
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'index change' do
|
46
|
+
i = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
47
|
+
@fest.make_wav('Пример')
|
48
|
+
@fest.delete_wav
|
49
|
+
x = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
50
|
+
expect(i).to eq(x)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'for pause' do
|
55
|
+
it '#play_wav' do
|
56
|
+
@fest.make_wav('Вы числ+яю энт ро+п+ии ю вселенной')
|
57
|
+
@fest.play_wav
|
58
|
+
expect($?.success?).to be_truthy
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Fest do
|
4
|
+
describe '#initialize' do
|
5
|
+
params = YAML.load_file("#{GEM_ROOT}/config/default.yml")
|
6
|
+
let(:loader) { described_class.new(params) }
|
7
|
+
|
8
|
+
params.each do |key, value|
|
9
|
+
let(":#{key}") { value.is_a?(Array) ? eval(value.join('; ')) : value }
|
10
|
+
|
11
|
+
context "when initialized with a set of @#{key}" do
|
12
|
+
it "from params['#{key}']" do
|
13
|
+
@path = params['path'] if key == 'index'
|
14
|
+
expect(loader.instance_variable_get("@#{key}".to_sym)).
|
15
|
+
to eq(value.is_a?(Array) ? eval(value.join('; ')) : value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Fest do
|
4
|
+
describe '#initialize' do
|
5
|
+
params = YAML.load_file("#{GEM_ROOT}/config/default.yml")
|
6
|
+
let(:loader) { described_class.new }
|
7
|
+
|
8
|
+
params.each do |key, value|
|
9
|
+
let(":#{key}") { value.is_a?(Array) ? eval(value.join('; ')) : value }
|
10
|
+
|
11
|
+
context "when initialized with a set of @#{key}" do
|
12
|
+
it "from params['#{key}']" do
|
13
|
+
@path = params['path'] if key == 'index'
|
14
|
+
expect(loader.instance_variable_get("@#{key}".to_sym)).
|
15
|
+
to eq(value.is_a?(Array) ? eval(value.join('; ')) : value)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
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
|
+
version: 1.3.10
|
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-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '10.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '10.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: '3.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: '3.3'
|
41
41
|
description: Ruby wrapper for festival scripts
|
42
42
|
email: afay.zangetsu@gmail.com
|
43
43
|
executables: []
|
@@ -47,19 +47,21 @@ extra_rdoc_files:
|
|
47
47
|
- README.md
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
|
+
- ".rspec"
|
50
51
|
- ".travis.yml"
|
51
52
|
- Gemfile
|
52
53
|
- License.org
|
53
54
|
- README.md
|
54
55
|
- Rakefile
|
55
56
|
- changelog.org
|
57
|
+
- config/conditions.yml
|
58
|
+
- config/default.yml
|
56
59
|
- fest.gemspec
|
57
60
|
- lib/fest.rb
|
58
|
-
- lib/fest/conditions.rb
|
59
|
-
- lib/fest/params.rb
|
60
61
|
- lib/fest/volume.rb
|
61
|
-
- spec/
|
62
|
-
- spec/
|
62
|
+
- spec/fest_spec.rb
|
63
|
+
- spec/params/custom_spec.rb
|
64
|
+
- spec/params/default_spec.rb
|
63
65
|
- spec/spec_helper.rb
|
64
66
|
homepage: https://github.com/AfsmNGhr/fest
|
65
67
|
licenses:
|
@@ -69,6 +71,7 @@ post_install_message:
|
|
69
71
|
rdoc_options: []
|
70
72
|
require_paths:
|
71
73
|
- lib
|
74
|
+
- config
|
72
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
76
|
requirements:
|
74
77
|
- - ">="
|
@@ -85,12 +88,12 @@ requirements:
|
|
85
88
|
- Festival snpeech engine
|
86
89
|
- xbacklight
|
87
90
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.5.0
|
89
92
|
signing_key:
|
90
93
|
specification_version: 4
|
91
94
|
summary: Ruby wrapper for festival speech engine
|
92
95
|
test_files:
|
93
|
-
- spec/
|
94
|
-
- spec/
|
96
|
+
- spec/fest_spec.rb
|
97
|
+
- spec/params/custom_spec.rb
|
98
|
+
- spec/params/default_spec.rb
|
95
99
|
- spec/spec_helper.rb
|
96
|
-
has_rdoc:
|
data/lib/fest/conditions.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
#
|
3
|
-
module Conditions
|
4
|
-
def check_conditions
|
5
|
-
check_light
|
6
|
-
check_home_theater
|
7
|
-
end
|
8
|
-
|
9
|
-
def check_light
|
10
|
-
exit if @params[:backlight].nil? && `xbacklight`.to_i == 0
|
11
|
-
end
|
12
|
-
|
13
|
-
def check_home_theater
|
14
|
-
xbmc = `ps -el | grep xbmc | wc -l`.to_i
|
15
|
-
vlc = `ps -el | grep vlc | wc -l`.to_i
|
16
|
-
kodi = `ps -el | grep kodi | wc -l`.to_i
|
17
|
-
exit if xbmc > 0 || vlc > 0 || kodi > 0
|
18
|
-
end
|
19
|
-
end
|
data/lib/fest/params.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
#
|
3
|
-
module Params
|
4
|
-
def path
|
5
|
-
@path = @params[:path] || '/tmp'
|
6
|
-
end
|
7
|
-
|
8
|
-
def current_volume
|
9
|
-
@current_volume = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
10
|
-
end
|
11
|
-
|
12
|
-
def index
|
13
|
-
@index = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
14
|
-
@index > 0 ? @index += 1 : @index = 1
|
15
|
-
end
|
16
|
-
|
17
|
-
def min_volume
|
18
|
-
@min_volume = @params[:min_volume] || 20
|
19
|
-
end
|
20
|
-
|
21
|
-
def max_volume
|
22
|
-
@max_volume = @params[:max_volume] || 60
|
23
|
-
end
|
24
|
-
|
25
|
-
def step
|
26
|
-
@step = @params[:step] || 4
|
27
|
-
end
|
28
|
-
|
29
|
-
def language
|
30
|
-
@language = @params[:language] || 'voice_msu_ru_nsh_clunits'
|
31
|
-
end
|
32
|
-
end
|
data/spec/custom_params_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Fest do
|
4
|
-
before(:each) do
|
5
|
-
@fest = Fest.new
|
6
|
-
@fest.params = {:language => 'cmu_us_slt_arctic_hts',
|
7
|
-
:min_volume => 30,
|
8
|
-
:max_volume => 70,
|
9
|
-
:step => 3,
|
10
|
-
:path => '~/'}
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'check custom params' do
|
14
|
-
params = {:language => 'cmu_us_slt_arctic_hts',
|
15
|
-
:min_volume => 30,
|
16
|
-
:max_volume => 70,
|
17
|
-
:step => 3,
|
18
|
-
:path => '~/'}
|
19
|
-
expect(@fest.params).to eq(params)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'check custom path in params' do
|
23
|
-
expect(@fest.path).to eq('~/')
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'check custom min volume' do
|
27
|
-
expect(@fest.min_volume).to eq(30)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'check custom max volume' do
|
31
|
-
expect(@fest.max_volume).to eq(70)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'check custom step' do
|
35
|
-
expect(@fest.step).to eq(3)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'check custom language' do
|
39
|
-
expect(@fest.language).to eq('cmu_us_slt_arctic_hts')
|
40
|
-
end
|
41
|
-
end
|
data/spec/default_params_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Fest do
|
4
|
-
before(:each) do
|
5
|
-
@fest = Fest.new
|
6
|
-
@fest.params = {}
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'check default params' do
|
10
|
-
expect(@fest.params).to eq({})
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'check default path' do
|
14
|
-
expect(@fest.path).to eq('/tmp')
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'check current volume' do
|
18
|
-
vol = `amixer | grep -o '[0-9]*' | sed "5 ! d"`.to_i
|
19
|
-
expect(@fest.current_volume).to eq(vol)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'check index' do
|
23
|
-
i = `ls -r #{@path} | grep -o '[0-9]*' | sed "1 ! d"`.to_i
|
24
|
-
expect(@fest.index).not_to eq(i)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'check default min volume' do
|
28
|
-
expect(@fest.min_volume).to eq(20)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'check default max volume' do
|
32
|
-
expect(@fest.max_volume).to eq(60)
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'check default step' do
|
36
|
-
expect(@fest.step).to eq(4)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'check default language' do
|
40
|
-
expect(@fest.language).to eq('voice_msu_ru_nsh_clunits')
|
41
|
-
end
|
42
|
-
end
|