aozora-polly 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/aozora-polly.gemspec +1 -0
- data/exe/aozora2mp3 +15 -0
- data/exe/aozora2ssml +1 -2
- data/lib/aozora-polly.rb +4 -0
- data/lib/aozora_polly/builder.rb +16 -0
- data/lib/aozora_polly/version.rb +1 -1
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f10f8a1a9a04126f6b7e21e7ddf2dfe041825cb0
|
4
|
+
data.tar.gz: cb279890d584ce56fed43ebfe5b8a90dd1cde31a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a964052741afdc4a2af4989554cd172fa48e642bf62a876612ba8c191d02b7eda78e25d4dfc563e6e9cf8d480c0886d80eaa6bda6f7b86f9944095b8d4b5939d
|
7
|
+
data.tar.gz: a5ef7b715946ac0958560cee1bd2d4d9dd0c2f24d6a66793ef2557dbe0db866477184352c999e43e67f765ce41c6b6d56dae7da034290c5f0f72db339324b605
|
data/README.md
CHANGED
@@ -23,7 +23,14 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
+
```bash
|
27
|
+
$ aozora2ssml http://www.aozora.gr.jp/cards/000035/files/1567_14913.html merosu.ssml
|
28
|
+
$ aozora2mp3 http://www.aozora.gr.jp/cards/000035/files/1567_14913.html merosu.mp3
|
29
|
+
```
|
30
|
+
|
26
31
|
```ruby
|
32
|
+
AozoraPolly.url2mp3("http://www.aozora.gr.jp/cards/000035/files/1567_14913.html", "merosu.mp3")
|
33
|
+
AozoraPolly.url2ssml("http://www.aozora.gr.jp/cards/000035/files/1567_14913.html") # => ssml string
|
27
34
|
AozoraPolly.html2ssml(html) # => ssml string
|
28
35
|
```
|
29
36
|
|
data/aozora-polly.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
+
spec.add_dependency "ssml2mp3", "~> 0.1.0"
|
23
24
|
spec.add_dependency "sanitize", "~> 4.4"
|
24
25
|
spec.add_dependency "nokogiri", ">= 1.6"
|
25
26
|
|
data/exe/aozora2mp3
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'aozora-polly'
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
puts "#$0 url mp3"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
aozora_url, mp3_path = ARGV
|
13
|
+
|
14
|
+
AozoraPolly.url2mp3(aozora_url, mp3_path)
|
15
|
+
puts "Generated: #{mp3_path}"
|
data/exe/aozora2ssml
CHANGED
data/lib/aozora-polly.rb
CHANGED
data/lib/aozora_polly/builder.rb
CHANGED
@@ -1,8 +1,24 @@
|
|
1
|
+
require "ssml2mp3"
|
1
2
|
require "sanitize"
|
2
3
|
require "net/http"
|
3
4
|
|
4
5
|
module AozoraPolly
|
5
6
|
class Builder
|
7
|
+
attr_reader :mp3_builder
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@mp3_builder = Ssml2mp3::Builder.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def url2mp3(aozora_url, mp3_path)
|
14
|
+
ssml = url2ssml(aozora_url)
|
15
|
+
|
16
|
+
basename = File.basename(mp3_path, ".mp3")
|
17
|
+
File.open(mp3_path, "wb") do |output|
|
18
|
+
mp3_builder.synthesize(ssml, basename, output)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
6
22
|
def url2ssml(aozora_url)
|
7
23
|
uri = URI.parse(aozora_url)
|
8
24
|
html = Net::HTTP.get(uri).force_encoding("cp932")
|
data/lib/aozora_polly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aozora-polly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hogelog
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ssml2mp3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: sanitize
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +112,7 @@ description:
|
|
98
112
|
email:
|
99
113
|
- konbu.komuro@gmail.com
|
100
114
|
executables:
|
115
|
+
- aozora2mp3
|
101
116
|
- aozora2ssml
|
102
117
|
extensions: []
|
103
118
|
extra_rdoc_files: []
|
@@ -112,6 +127,7 @@ files:
|
|
112
127
|
- aozora-polly.gemspec
|
113
128
|
- bin/console
|
114
129
|
- bin/setup
|
130
|
+
- exe/aozora2mp3
|
115
131
|
- exe/aozora2ssml
|
116
132
|
- lib/aozora-polly.rb
|
117
133
|
- lib/aozora_polly/builder.rb
|