ted_talk 0.0.11 → 0.0.21
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.
- data/README.md +1 -0
- data/bin/ted_talk +8 -6
- data/lib/ted_talk.rb +6 -3
- data/lib/ted_talk/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -37,6 +37,7 @@ TedTalk requires [FFmpeg](http://ffmpeg.org/) and [SoX](http://sox.sourceforge.n
|
|
37
37
|
--lang, -l <s>: Language of description (default: en)
|
38
38
|
--rss, -r: Show descriptions of the newest talks from TED Talk RSS
|
39
39
|
--url, -u <s>: URL of a specific TED Talk
|
40
|
+
--video, -v: Save not only audio but also the original video
|
40
41
|
--help, -h: Show this message
|
41
42
|
|
42
43
|
### exec
|
data/bin/ted_talk
CHANGED
@@ -26,13 +26,13 @@ global_opts = Trollop::options do
|
|
26
26
|
banner <<-EOS
|
27
27
|
TedTalk helps download TED talk video and covert it to a slowed down MP3 with pauses that is helpful for English learning
|
28
28
|
|
29
|
-
Basic usage:
|
30
|
-
|
31
|
-
|
29
|
+
Basic usage: ted_talk desc <option> - show TED Talk description(s)
|
30
|
+
ted_talk exec <option> - download and convert a TED Talk video
|
31
|
+
ted_talk delete - delete cache folder
|
32
32
|
|
33
33
|
For details about <option>, type:
|
34
|
-
|
35
|
-
or
|
34
|
+
ted_talk desc -h
|
35
|
+
or ted_talk exec -h
|
36
36
|
|
37
37
|
[global options]:
|
38
38
|
EOS
|
@@ -89,6 +89,7 @@ EOS
|
|
89
89
|
opt :outdir, "Directory for file output", :default=> "./"
|
90
90
|
opt :speed, "Speed of output file [0.1 - 100]", :default => 1.0
|
91
91
|
opt :silence, "Length (secondes) of a pause added to each utterance [0.1 - 120]", :default => 0.0
|
92
|
+
opt :video, "Save not only audio but also the original video", :default => false
|
92
93
|
end
|
93
94
|
|
94
95
|
Trollop::die :outdir, "must be an existing directory" unless File::ftype(exec_opts[:outdir]) == "directory"
|
@@ -100,9 +101,10 @@ EOS
|
|
100
101
|
outdir = exec_opts[:outdir]
|
101
102
|
speed = exec_opts[:speed]
|
102
103
|
silence = exec_opts[:silence]
|
104
|
+
video = exec_opts[:video]
|
103
105
|
|
104
106
|
tedtalk = TedTalk::Converter.new(source_url)
|
105
|
-
tedtalk.execute(outdir, lang, speed, silence)
|
107
|
+
tedtalk.execute(outdir, lang, speed, silence, video)
|
106
108
|
when "delete"
|
107
109
|
TedTalk.delete_cache
|
108
110
|
else
|
data/lib/ted_talk.rb
CHANGED
@@ -137,7 +137,7 @@ module TedTalk
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
def execute(outdir = "./", lang = "en", speed = 1, silence = 0)
|
140
|
+
def execute(outdir = "./", lang = "en", speed = 1, silence = 0, video = false)
|
141
141
|
puts "TedTalk is prepararing for the process"
|
142
142
|
@outdir = File.join(outdir, @ted_id + "-" + @basename)
|
143
143
|
Dir.mkdir(@outdir) unless File.exists?(@outdir)
|
@@ -148,12 +148,15 @@ module TedTalk
|
|
148
148
|
get_captions("en")
|
149
149
|
setup_lang(lang)
|
150
150
|
get_captions(lang)
|
151
|
-
video_filepath = get_binary(@video_url)
|
151
|
+
video_filepath = get_binary(@video_url)
|
152
152
|
wav_filepath = get_wav(video_filepath)
|
153
153
|
outfile = @outdir + "/" + @basename + "-result.mp3"
|
154
154
|
speakslow = SpeakSlow::Converter.new(wav_filepath, outfile)
|
155
155
|
speakslow.execute(speed, silence)
|
156
|
-
write_info(outfile)
|
156
|
+
write_info(outfile)
|
157
|
+
if video
|
158
|
+
`cp #{video_filepath} #{@outdir + "/"}`
|
159
|
+
end
|
157
160
|
end
|
158
161
|
|
159
162
|
def get_title(lang)
|
data/lib/ted_talk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ted_talk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|