speech_to_text 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -28
- data/lib/speech_to_text/util.rb +13 -3
- data/lib/speech_to_text/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0555b2eb876fc204f1c3c74365172849767e78d26e92a11b2eb76ca5cb5627e
|
4
|
+
data.tar.gz: ccc2c7e546ffafaa8c7855a185ce69a8f552ce4fcfa8f6499fbf67720f87d74f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3fe3c9c3db83fb650ab3c69cf24332a99fa6595a966191ff5ae35d68287abc6bbd24c1e4ee1f32e2b173911e85d5e15bac2b75291447a5ee067e27ba6a9c8b1
|
7
|
+
data.tar.gz: 71b507378f8afac67e58cf7618cb61db1cdb27a27a5d864346398ee0e2b61fb00076aaf2b22dfab83f69b907513a608ef62ccd1dd84cef73a1938c0bc2dde625
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
speech_to_text (0.1.
|
4
|
+
speech_to_text (0.1.2)
|
5
5
|
google-cloud-speech (= 0.35.0)
|
6
6
|
google-cloud-storage (= 1.18.2)
|
7
7
|
ibm_watson (~> 0.18.2)
|
@@ -9,8 +9,8 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
public_suffix (>= 2.0.2, <
|
12
|
+
addressable (2.7.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
concurrent-ruby (1.1.5)
|
15
15
|
declarative (0.0.10)
|
16
16
|
declarative-option (0.1.0)
|
@@ -18,22 +18,22 @@ GEM
|
|
18
18
|
domain_name (0.5.20190701)
|
19
19
|
unf (>= 0.0.5, < 1.0.0)
|
20
20
|
eventmachine (1.2.7)
|
21
|
-
faraday (0.
|
21
|
+
faraday (0.17.0)
|
22
22
|
multipart-post (>= 1.2, < 3)
|
23
23
|
faye-websocket (0.10.9)
|
24
24
|
eventmachine (>= 0.12.0)
|
25
25
|
websocket-driver (>= 0.5.1)
|
26
|
-
google-api-client (0.
|
26
|
+
google-api-client (0.33.1)
|
27
27
|
addressable (~> 2.5, >= 2.5.1)
|
28
|
-
googleauth (
|
28
|
+
googleauth (~> 0.9)
|
29
29
|
httpclient (>= 2.8.1, < 3.0)
|
30
30
|
mini_mime (~> 1.0)
|
31
31
|
representable (~> 3.0)
|
32
32
|
retriable (>= 2.0, < 4.0)
|
33
|
-
signet (~> 0.
|
34
|
-
google-cloud-core (1.3.
|
33
|
+
signet (~> 0.12)
|
34
|
+
google-cloud-core (1.3.2)
|
35
35
|
google-cloud-env (~> 1.0)
|
36
|
-
google-cloud-env (1.2.
|
36
|
+
google-cloud-env (1.2.1)
|
37
37
|
faraday (~> 0.11)
|
38
38
|
google-cloud-speech (0.35.0)
|
39
39
|
google-gax (~> 1.3)
|
@@ -44,31 +44,27 @@ GEM
|
|
44
44
|
google-cloud-core (~> 1.2)
|
45
45
|
googleauth (>= 0.6.2, < 0.10.0)
|
46
46
|
mime-types (~> 3.0)
|
47
|
-
google-gax (1.
|
48
|
-
google-protobuf (~> 3.
|
49
|
-
googleapis-common-protos (>= 1.3.
|
50
|
-
googleauth (
|
51
|
-
grpc (
|
47
|
+
google-gax (1.8.1)
|
48
|
+
google-protobuf (~> 3.9)
|
49
|
+
googleapis-common-protos (>= 1.3.9, < 2.0)
|
50
|
+
googleauth (~> 0.9)
|
51
|
+
grpc (~> 1.24)
|
52
52
|
rly (~> 0.2.3)
|
53
|
-
google-protobuf (3.
|
54
|
-
google-protobuf (3.8.0-x64-mingw32)
|
53
|
+
google-protobuf (3.10.0-x86_64-linux)
|
55
54
|
googleapis-common-protos (1.3.9)
|
56
55
|
google-protobuf (~> 3.0)
|
57
56
|
googleapis-common-protos-types (~> 1.0)
|
58
57
|
grpc (~> 1.0)
|
59
58
|
googleapis-common-protos-types (1.0.4)
|
60
59
|
google-protobuf (~> 3.0)
|
61
|
-
googleauth (0.
|
60
|
+
googleauth (0.9.0)
|
62
61
|
faraday (~> 0.12)
|
63
62
|
jwt (>= 1.4, < 3.0)
|
64
63
|
memoist (~> 0.16)
|
65
64
|
multi_json (~> 1.11)
|
66
65
|
os (>= 0.9, < 2.0)
|
67
66
|
signet (~> 0.7)
|
68
|
-
grpc (1.
|
69
|
-
google-protobuf (~> 3.7)
|
70
|
-
googleapis-common-protos-types (~> 1.0)
|
71
|
-
grpc (1.21.0-x64-mingw32)
|
67
|
+
grpc (1.24.0-x86_64-linux)
|
72
68
|
google-protobuf (~> 3.8)
|
73
69
|
googleapis-common-protos-types (~> 1.0)
|
74
70
|
http (4.1.1)
|
@@ -81,7 +77,7 @@ GEM
|
|
81
77
|
http-form_data (2.1.1)
|
82
78
|
http_parser.rb (0.6.0)
|
83
79
|
httpclient (2.8.3)
|
84
|
-
ibm_cloud_sdk_core (0.3.
|
80
|
+
ibm_cloud_sdk_core (0.3.3)
|
85
81
|
concurrent-ruby (~> 1.0)
|
86
82
|
http (~> 4.1.0)
|
87
83
|
jwt (~> 2.2.1)
|
@@ -94,14 +90,14 @@ GEM
|
|
94
90
|
jwt (~> 2.2.1)
|
95
91
|
jwt (2.2.1)
|
96
92
|
memoist (0.16.0)
|
97
|
-
mime-types (3.
|
93
|
+
mime-types (3.3)
|
98
94
|
mime-types-data (~> 3.2015)
|
99
|
-
mime-types-data (3.2019.
|
95
|
+
mime-types-data (3.2019.1009)
|
100
96
|
mini_mime (1.0.2)
|
101
|
-
multi_json (1.
|
97
|
+
multi_json (1.14.1)
|
102
98
|
multipart-post (2.1.1)
|
103
99
|
os (1.0.1)
|
104
|
-
public_suffix (
|
100
|
+
public_suffix (4.0.1)
|
105
101
|
rake (10.5.0)
|
106
102
|
representable (3.0.4)
|
107
103
|
declarative (< 0.1.0)
|
@@ -109,7 +105,7 @@ GEM
|
|
109
105
|
uber (< 0.2.0)
|
110
106
|
retriable (3.1.2)
|
111
107
|
rly (0.2.3)
|
112
|
-
signet (0.
|
108
|
+
signet (0.12.0)
|
113
109
|
addressable (~> 2.3)
|
114
110
|
faraday (~> 0.9)
|
115
111
|
jwt (>= 1.5, < 3.0)
|
@@ -124,7 +120,6 @@ GEM
|
|
124
120
|
|
125
121
|
PLATFORMS
|
126
122
|
ruby
|
127
|
-
x64-mingw32
|
128
123
|
|
129
124
|
DEPENDENCIES
|
130
125
|
bundler (~> 2.0)
|
data/lib/speech_to_text/util.rb
CHANGED
@@ -117,10 +117,20 @@ module SpeechToText
|
|
117
117
|
video_content_type:,
|
118
118
|
audio_file_path:,
|
119
119
|
audio_name:,
|
120
|
-
audio_content_type
|
120
|
+
audio_content_type:,
|
121
|
+
**duration)
|
121
122
|
# rubocop:enable Metrics/ParameterLists
|
122
|
-
|
123
|
-
|
123
|
+
if duration.empty?
|
124
|
+
video_to_audio_command = "ffmpeg -i #{video_file_path}/#{video_name}.#{video_content_type} -ac 1 -ar 16000 #{audio_file_path}/#{audio_name}.#{audio_content_type}"
|
125
|
+
system(video_to_audio_command.to_s)
|
126
|
+
elsif duration.length == 1
|
127
|
+
video_to_audio_command = "ffmpeg -ss #{0.to_i} -i #{video_file_path}/#{video_name}.#{video_content_type} -t #{duration.values[0]} -ac 1 -ar 16000 #{audio_file_path}/#{audio_name}.#{audio_content_type}"
|
128
|
+
system(video_to_audio_command.to_s)
|
129
|
+
else
|
130
|
+
video_to_audio_command = "ffmpeg -ss #{duration.values[0]} -i #{video_file_path}/#{video_name}.#{video_content_type} -t #{duration.values[1]} -ac 1 -ar 16000 #{audio_file_path}/#{audio_name}.#{audio_content_type}"
|
131
|
+
system(video_to_audio_command.to_s)
|
132
|
+
end
|
133
|
+
|
124
134
|
end
|
125
135
|
end
|
126
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speech_to_text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Alam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|