cerecvoice2019 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/cerecvoice2019.rb +37 -33
- data.tar.gz.sig +0 -0
- metadata +33 -32
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502921a90e9336a2f54bdaf92386543340b617898fce96a764612da096820e08
|
4
|
+
data.tar.gz: d45935e2eaf8cd21454ca2b4e1891fb2049c35e8c58aeea0f8028f3f6b87fdd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 307db3b28bcd09cba841b912177d442fc6c51f05464604f09fde9be89e4ec05610c608d446fbd56f87e889cfc08c023f88dfb6a85faf02746d442123fb1efa5e
|
7
|
+
data.tar.gz: 68926f9f1369cd0a067b12b23e33f39a661cbf12b3d2c4a9cedc8ef20169478d16039f059c9657b3c2c24b23dab3ecd030eea69c9dbdd90fef831386c11f4c82
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/cerecvoice2019.rb
CHANGED
@@ -9,10 +9,13 @@ require 'rxfhelper'
|
|
9
9
|
# English voices
|
10
10
|
# --------------
|
11
11
|
#
|
12
|
-
# England: Claire (Lancashire), Giles, Jack, Jess, Lauren, Sarah,
|
13
|
-
# Sue (Black Country), William
|
12
|
+
# England: Claire (Lancashire), Giles, Jack, Jess, Lauren, Sarah,
|
13
|
+
# Sue (Black Country), William, Adam
|
14
14
|
# Ireland: Caitlin
|
15
|
-
# Scotland:
|
15
|
+
# Scotland: Heather, Kirsty, Stuart, Andrew, Mairi
|
16
|
+
# United States: Andy, Carolyn, Hannah, Isabella, Jordan, Katherine, Megan,
|
17
|
+
# Nathan
|
18
|
+
# France: Nicole
|
16
19
|
#
|
17
20
|
|
18
21
|
class Cerecvoice2019Error < Exception
|
@@ -21,71 +24,72 @@ end
|
|
21
24
|
class Cerecvoice2019
|
22
25
|
include RXFHelperModule
|
23
26
|
using ColouredText
|
24
|
-
|
25
|
-
def initialize(accountid: nil, password: nil, voice: 'Heather', config: {},
|
26
|
-
cache_filepath: 'cache',
|
27
|
+
|
28
|
+
def initialize(accountid: nil, password: nil, voice: 'Heather', config: {},
|
29
|
+
cache_filepath: 'cache',
|
27
30
|
url: 'https://cerevoice.com/rest/rest_1_1.php', debug: false)
|
28
31
|
|
29
32
|
@config = ({
|
30
|
-
'method' => 'speakExtended',
|
33
|
+
'method' => 'speakExtended',
|
31
34
|
'accountID' => accountid,
|
32
|
-
'password' => password,
|
35
|
+
'password' => password,
|
33
36
|
'voice' => voice,
|
34
37
|
'audioFormat' => 'ogg',
|
35
38
|
'sampleRate' => '48000',
|
36
39
|
'metadata' => 'True',
|
37
40
|
'audio3D' => 'True'
|
38
41
|
}).merge config
|
39
|
-
|
42
|
+
|
40
43
|
@url, @cache_filepath, @debug = url, cache_filepath, debug
|
41
44
|
|
42
45
|
if @config['accountID'].nil? or @config['password'].nil? then
|
43
|
-
raise Cerecvoice2019Error, 'invalid accountID or password'
|
44
|
-
end
|
45
|
-
|
46
|
+
raise Cerecvoice2019Error, 'invalid accountID or password'
|
47
|
+
end
|
48
|
+
|
46
49
|
end
|
47
50
|
|
48
51
|
def tts(text='', voice=@config['voice'], out: 'output.' + @config['audioFormat'])
|
49
52
|
|
50
|
-
|
51
|
-
audiofile_out
|
52
|
-
|
53
|
+
|
54
|
+
audiofile_out = out
|
55
|
+
@config['audioFormat'] = File.extname(out)[1..-1]
|
56
|
+
|
57
|
+
|
53
58
|
raise Cerecvoice2019Error, 'text empty' if text.empty?
|
54
|
-
|
59
|
+
|
55
60
|
FileUtils.mkdir_p @cache_filepath
|
56
|
-
|
61
|
+
|
57
62
|
h = Digest::MD5.new << text + voice
|
58
63
|
filename = File.join(@cache_filepath, h.to_s + '.'+ @config['audioFormat'])
|
59
|
-
|
60
|
-
|
61
|
-
# attempts to find the audio file from a local cache instead of
|
64
|
+
|
65
|
+
|
66
|
+
# attempts to find the audio file from a local cache instead of
|
62
67
|
# making a relatively expensive request through the web API
|
63
|
-
|
68
|
+
|
64
69
|
if not File.exists? filename then
|
65
|
-
|
70
|
+
|
66
71
|
@config.merge!('text' => CGI.escape(text), 'voice' => voice)
|
67
72
|
url = @url + '?' + @config.map {|x| x.join('=')}.join('&')
|
68
73
|
puts ('url: ' + url.inspect).debug if @debug
|
69
|
-
xml = open(url).read
|
74
|
+
xml = URI.open(url).read
|
70
75
|
puts ('xml: ' + xml.inspect).debug if @debug
|
71
|
-
|
76
|
+
|
72
77
|
doc = Rexle.new xml
|
73
78
|
audio_url = doc.root.text('fileUrl')
|
74
79
|
puts ('audio_url: ' + audio_url.inspect).debug if @debug
|
75
|
-
|
76
|
-
|
80
|
+
|
81
|
+
|
77
82
|
puts ('writing file: ' + filename.inspect).debug if @debug
|
78
|
-
|
83
|
+
|
79
84
|
File.open(filename, "wb") do |saved_file|
|
80
85
|
# the following "open" is provided by open-uri
|
81
|
-
open(audio_url) {|read_file| saved_file.write(read_file.read) }
|
82
|
-
end
|
86
|
+
URI.open(audio_url) {|read_file| saved_file.write(read_file.read) }
|
87
|
+
end
|
83
88
|
|
84
|
-
end
|
85
|
-
|
86
|
-
|
89
|
+
end
|
90
|
+
|
91
|
+
FileX.cp filename, audiofile_out
|
87
92
|
|
88
93
|
end
|
89
94
|
|
90
95
|
end
|
91
|
-
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cerecvoice2019
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,32 +10,33 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
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w+97YQh7OSFsJXrkZ38Z0sKikOBzcf3RmVxRPPjWG4QT
|
25
|
+
wwsdWvF7pbaPTG3BIBIEKScIcES+t437REbdC0vbQiiHBRHnlSA1+ia+jjuFIOLj
|
26
|
+
+RU9qQIDAQABo4GKMIGHMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
27
|
+
BBQQKFuJqAvy6O4z1SaAGsvM5S4ASjAmBgNVHREEHzAdgRtnZW1tYXN0ZXJAamFt
|
28
|
+
ZXNyb2JlcnRzb24uZXUwJgYDVR0SBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
29
|
+
c29uLmV1MA0GCSqGSIb3DQEBCwUAA4IBgQCP6g81gtAt1UVXaxbg2R1HwG8mGtZh
|
30
|
+
CzuvI2iS11tJdYcSbb+ry0K0yfwyM7NM9B2ghBXqN8jpVXkrL1cEahXoAEXdHYe7
|
31
|
+
NPjWhqwfj/tMDNXCoZXL6Eqvji179aG/gioZRNVF2ajiCKu/DxcxOdRaaGDAXwry
|
32
|
+
ChVYd4FD+9N9pIG0dgtKfJSo7mGe/aquxV5Z9fL62z8NFCLwOuh4+N3wgRL7tAHm
|
33
|
+
ZV4ESC6patDckxyP42dbRwjwBBQZNsLSPwsjmAYSNqpbV6NxRL74TlqlOMVtBwhC
|
34
|
+
czgSrPxGuhywKTWqivm8TQk3iRVIEI0Q5AkzLogUOyhShfRIKmkBrOftVoWy7rkR
|
35
|
+
x9NRjWihp2UJek5sZx332XksoSqzO0W7RUKuddiTDXHRrd7kxtba6JM6NqRS7m47
|
36
|
+
hYpP9/k+i5ttHESknFpij4j0fsDhfh0l616jaUyXVegOL/79bnx043t+w7JvCsAL
|
37
|
+
RrDC3HXoRpS5Xo/m99HQ8k9qx/h5l0gcDJA=
|
37
38
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
39
|
+
date: 2022-06-30 00:00:00.000000000 Z
|
39
40
|
dependencies:
|
40
41
|
- !ruby/object:Gem::Dependency
|
41
42
|
name: rxfhelper
|
@@ -43,22 +44,22 @@ dependencies:
|
|
43
44
|
requirements:
|
44
45
|
- - "~>"
|
45
46
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
47
|
+
version: '1.6'
|
47
48
|
- - ">="
|
48
49
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
50
|
+
version: 1.6.3
|
50
51
|
type: :runtime
|
51
52
|
prerelease: false
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
53
54
|
requirements:
|
54
55
|
- - "~>"
|
55
56
|
- !ruby/object:Gem::Version
|
56
|
-
version: '1.
|
57
|
+
version: '1.6'
|
57
58
|
- - ">="
|
58
59
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
60
|
+
version: 1.6.3
|
60
61
|
description:
|
61
|
-
email:
|
62
|
+
email: digital.robertson@gmail.com
|
62
63
|
executables: []
|
63
64
|
extensions: []
|
64
65
|
extra_rdoc_files: []
|
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
84
|
- !ruby/object:Gem::Version
|
84
85
|
version: '0'
|
85
86
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
+
rubygems_version: 3.3.7
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: 'Unofficial Cerevoice gem using their text-to-speech API. #tts'
|
metadata.gz.sig
CHANGED
Binary file
|