fest 1.0.7 → 1.1.7

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.org +18 -1
  3. data/changelog.org +3 -0
  4. data/fest.gemspec +1 -1
  5. data/lib/fest.rb +36 -17
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 007d77826bbe60048b450b36fb760c932f23a8f4
4
- data.tar.gz: 6c6afb39d04586cd1992371d02d362e7b7c44c38
3
+ metadata.gz: c4f073ae98dea625af53c70899cd62f7991e910d
4
+ data.tar.gz: 428db928ff0dc7cc790c4e0ce1ca6fc2836f9f38
5
5
  SHA512:
6
- metadata.gz: 34697b9fe1f6d4c0be0fda8c46b28cb8f3559c8f08514796dbac142fe5d01a9b08472d221099eaa9f3cb6f7f2a74da5a0dd3a20716b85e4e3f8c05ed7f5b92df
7
- data.tar.gz: 5ee36535af1631ac42d6c800f3c738979d662349a98aaa1146df3d4d7e7f0b19e5c2963eaa734abd1fb6e66d0a1091b0c2e4e496da05faa98e50fb81f15a5908
6
+ metadata.gz: ed6a552aed74d936618e0f07caa5202221b1cd6ee9c87e3a7267ad0cf3458b5142b4c2f492cab3dbf8bc3c202e7b32fb64b0769dc8ff9f479d831ec3a1dd06c1
7
+ data.tar.gz: fb2dc7d74bc25e88bf6c98188ea8f777f1495903df1c687c20819bc026126c67eda73482c7ae3d24ff03fe5ef14d2fcc607979093f56689020dbdc5e2915c3d5
data/README.org CHANGED
@@ -56,9 +56,16 @@ puts text
56
56
  @fest.optimize_min_and_max_volume(min_volume, max_volume)
57
57
  # Проверяет громкость и ставит min или max ...
58
58
 
59
+ @fest.check_conditions
60
+ # Проверяет условия
61
+ # check_light и check_home_theater
62
+
59
63
  @fest.check_light # (with xbacklight)
60
64
  # Проверяет яркость не равна ли нулю... если равна выходит...
61
- # Можно сделать свою проверку ...
65
+
66
+ @fest.check_home_theater
67
+ # Проверяет наличие запущенного vlc или xbmc ...
68
+ # Выходит если запущено...
62
69
 
63
70
  @fest.check_say_wav
64
71
  # Проверяем на max @index ... если нету @index = 1 ...
@@ -80,6 +87,7 @@ puts text
80
87
  # @down_volume = @current_volume / 10 * @params[:down_volume[2]]
81
88
 
82
89
  @fest.play_wav
90
+ # ставит @optimize_volume
83
91
  # выполняет turn_down_volume
84
92
  # Проигрывает wav ...
85
93
 
@@ -90,3 +98,12 @@ puts text
90
98
  @fest.delete_wav
91
99
  # Удаляет проигранный файл ...
92
100
  #+end_src
101
+ ** Решение проблем
102
+ ***** Уровень громкости не сбрасывает после выхода
103
+ ****** vlc
104
+ #+begin_src bash
105
+ #!/bin/bash
106
+
107
+ vlc.run --play-and-exit $*
108
+ amixer set Master 30% > /dev/null 2>&1
109
+ #+end_src
data/changelog.org CHANGED
@@ -1,3 +1,6 @@
1
+ ** 1.1.7 (2015-01-10 Сб)
2
+ - Добавлена проверка на vlc и xbmc
3
+ - aplay заменен на paplay
1
4
  ** 1.0.7 (2015-01-07 Ср)
2
5
  - Фикс min и max volume ...
3
6
  ** 1.0.6 (2015-01-07 Ср)
data/fest.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fest"
3
- s.version = "1.0.7"
3
+ s.version = "1.1.7"
4
4
  s.authors = ["Alexsey Ermolaev"]
5
5
  s.email = %q{afay.zangetsu@gmail.com}
6
6
  s.homepage = %q{https://github.com/AfsmNGhr/fest}
data/lib/fest.rb CHANGED
@@ -3,10 +3,10 @@
3
3
  class Fest
4
4
  def say(string, params = {})
5
5
  init(params)
6
- check_light
7
- @index = check_say_wav
6
+ check_conditions
7
+ check_say_wav
8
8
  make_wav(string)
9
- expect_if_aplay_now
9
+ expect_if_paplay_now
10
10
  check_optimal_volume
11
11
  play_wav
12
12
  return_current_volume
@@ -34,21 +34,32 @@ class Fest
34
34
  end
35
35
 
36
36
  def optimize_min_and_max_volume
37
- change_volume(
38
- if @current_volume > @max_volume
39
- @max_volume
40
- elsif @current_volume < @min_volume
41
- @min_volume
42
- else
43
- @current_volume
44
- end
37
+ @optimize_volume = (
38
+ if @current_volume > @max_volume
39
+ @max_volume
40
+ elsif @current_volume < @min_volume
41
+ @min_volume
42
+ else
43
+ @current_volume
44
+ end
45
45
  )
46
46
  end
47
47
 
48
+ def check_conditions
49
+ check_light
50
+ check_home_theater
51
+ end
52
+
48
53
  def check_light
49
54
  exit if @params[:backlight].nil? && `xbacklight`.to_i == 0
50
55
  end
51
56
 
57
+ def check_home_theater
58
+ xbmc = `ps -el | grep xbmc | wc -l`.to_i
59
+ vlc = `ps -el | grep vlc | wc -l`.to_i
60
+ exit if xbmc > 0 || vlc > 0
61
+ end
62
+
52
63
  def check_say_wav
53
64
  @index > 0 ? @index += 1 : @index = 1
54
65
  end
@@ -63,10 +74,10 @@ class Fest
63
74
  system("amixer set Master #{volume}% > /dev/null 2>&1")
64
75
  end
65
76
 
66
- def expect_if_aplay_now
77
+ def expect_if_paplay_now
67
78
  loop do
68
79
  sleep 1
69
- break if `ps -el | grep aplay | wc -l`.to_i == 0
80
+ break if `ps -el | grep paplay | wc -l`.to_i == 0
70
81
  end
71
82
  end
72
83
 
@@ -78,8 +89,10 @@ class Fest
78
89
  end
79
90
 
80
91
  def play_wav
92
+ change_volume(@optimize_volume)
81
93
  turn_down_volume
82
- system("aplay #{@path}/say_#{@index}.wav > /dev/null 2>&1")
94
+ system("paplay #{@path}/say_#{@index}.wav \
95
+ --volume='#{@optimize_volume * 655}' > /dev/null 2>&1")
83
96
  end
84
97
 
85
98
  def return_current_volume
@@ -96,8 +109,14 @@ class Fest
96
109
  n = number % 100
97
110
  m = n % 10
98
111
 
99
- n > 10 && n < 20 ? array[2] :
100
- m > 1 && m < 20 ? array[1] :
101
- m == 1 ? array[0] : array[2]
112
+ if n > 10 && n < 20
113
+ array[2]
114
+ elsif m > 1 && m < 5
115
+ array[1]
116
+ elsif m == 1
117
+ array[0]
118
+ else
119
+ array[2]
120
+ end
102
121
  end
103
122
  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.0.7
4
+ version: 1.1.7
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-01-06 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby wrapper for festival scripts
14
14
  email: afay.zangetsu@gmail.com