rubysounds 0.4 → 0.5
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/lib/rubysounds.rb +25 -8
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5fc8715d53adfff02a385b6ca1888918992d271
|
|
4
|
+
data.tar.gz: 4ea47deb47221f63360b7624015978510680f90b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b33d16c6cf3d68d5e150650f16475d715064905a00ca1b7d4013fac7d3e58dfacdec1acad6262a0b897391e45c1906c2095b65c933e1c521a93883d06c6c6ec
|
|
7
|
+
data.tar.gz: 898f2b9da6795c89fd0106e7d24f362063db2f8020fd7a2a2daeceae9e9d6bc1996337012069d1fff66cdf023ce1de97e5e4491c375be686778cb7ed6bd9ba91
|
data/lib/rubysounds.rb
CHANGED
|
@@ -95,8 +95,7 @@ end
|
|
|
95
95
|
# Array to store VLC sound processes
|
|
96
96
|
$children_sounds = Array.new
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
trap "SIGINT" do
|
|
98
|
+
def killallsounds
|
|
100
99
|
puts "Exiting"
|
|
101
100
|
# Kill all children sounds
|
|
102
101
|
for child_sound in $children_sounds
|
|
@@ -116,8 +115,17 @@ trap "SIGINT" do
|
|
|
116
115
|
exit 130
|
|
117
116
|
end
|
|
118
117
|
|
|
118
|
+
# Catching CTRL-C Keyboard Interrupt signal
|
|
119
|
+
Signal.trap('INT') do
|
|
120
|
+
killallsounds
|
|
121
|
+
end
|
|
122
|
+
# Catching QUIT signal
|
|
123
|
+
Signal.trap('TERM') do
|
|
124
|
+
killallsounds
|
|
125
|
+
end
|
|
126
|
+
|
|
119
127
|
|
|
120
|
-
def
|
|
128
|
+
def play(target, wait: true, bg: true, dummy: true, volume: 100, loop: false)
|
|
121
129
|
|
|
122
130
|
# VLC command options
|
|
123
131
|
if $operative_system == "win"
|
|
@@ -135,6 +143,15 @@ def vlcplay(target, wait: true, bg: false, dummy: true)
|
|
|
135
143
|
vlccmd = "cvlc --play-and-exit "
|
|
136
144
|
end
|
|
137
145
|
|
|
146
|
+
vlccmd += "--directx-volume " + (volume.to_f/100).to_s + " "
|
|
147
|
+
|
|
148
|
+
if loop
|
|
149
|
+
vlccmd += "--loop "
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# DEBUG ONLY
|
|
153
|
+
#puts(vlccmd)
|
|
154
|
+
|
|
138
155
|
io = IO.popen(vlccmd + target)
|
|
139
156
|
$children_sounds.push(io)
|
|
140
157
|
# Wait for the sound to end option
|
|
@@ -148,9 +165,9 @@ def vlcplay(target, wait: true, bg: false, dummy: true)
|
|
|
148
165
|
end
|
|
149
166
|
|
|
150
167
|
|
|
151
|
-
def speak(text, language: "en", wait: true, bg: true)
|
|
168
|
+
def speak(text, language: "en", wait: true, bg: true, volume: 100, loop: false)
|
|
152
169
|
Speech.new(text, language).save("temp.wav")
|
|
153
|
-
|
|
170
|
+
play("temp.wav", wait: wait, bg: bg, volume: volume, loop: loop)
|
|
154
171
|
File.delete("temp.wav")
|
|
155
172
|
end
|
|
156
173
|
|
|
@@ -161,9 +178,9 @@ def dub(text)
|
|
|
161
178
|
end
|
|
162
179
|
|
|
163
180
|
|
|
164
|
-
def play(path, wait: true, bg: true)
|
|
165
|
-
|
|
166
|
-
end
|
|
181
|
+
#def play(path, wait: true, bg: true, volume: 100, loop: false)
|
|
182
|
+
#play(path, wait: wait, bg: bg, volume: volume, loop: loop)
|
|
183
|
+
#end
|
|
167
184
|
|
|
168
185
|
|
|
169
186
|
# Windows-specific methods
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubysounds
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.5'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alessandro Norfo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-10-
|
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: Ruby library to manage sounds using Google Translate &
|
|
13
|
+
description: Ruby library to manage sounds using Google Translate & VLC.
|
|
14
14
|
email: ale.norfo@gmail.com
|
|
15
15
|
executables: []
|
|
16
16
|
extensions: []
|