ted_talk 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ TedTalk helps download TED talk video and covert it to a slowed down MP3 with pa
6
6
 
7
7
  ## Installation
8
8
 
9
- TedTalk requires [FFmpeg](http://ffmpeg.org/) and [SoX](http://sox.sourceforge.net/) with LAME support, as well as [TagLib](http://taglib.github.com/) audio meta-data library installed to the system
9
+ TedTalk requires [FFmpeg](http://ffmpeg.org/) and [SoX](http://sox.sourceforge.net/) **with LAME support** [important], as well as [TagLib](http://taglib.github.com/) audio meta-data library installed to the system
10
10
 
11
11
  $ gem install ted_talk
12
12
 
@@ -37,7 +37,6 @@ 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
41
40
  --help, -h: Show this message
42
41
 
43
42
  ### exec
@@ -55,4 +54,5 @@ TedTalk requires [FFmpeg](http://ffmpeg.org/) and [SoX](http://sox.sourceforge.n
55
54
  --speed, -s <f>: Speed of output file [0.1 - 100] (default: 1.0)
56
55
  --silence, -i <f>: Length (secondes) of a pause added to each utterance
57
56
  [0.1 - 120] (default: 0.0)
57
+ --video, -v: Save not only audio but also the original video
58
58
  --help, -h: Show this message
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: tedtalk desc <option> - show TED Talk description(s)
30
- tedtalk exec <option> - download and convert a TED Talk video
31
- tedtalk delete - delete cache folder
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
- tedtalk desc -h
35
- or tedtalk exec -h
34
+ ted_talk desc -h
35
+ or ted_talk exec -h
36
36
 
37
37
  [global options]:
38
38
  EOS
@@ -1,3 +1,3 @@
1
1
  module TedTalk
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/ted_talk.rb CHANGED
@@ -114,8 +114,8 @@ module TedTalk
114
114
  end
115
115
  @lang = lang
116
116
  if lang != "en"
117
- @titles[lang] = get_title(lang)
118
- @descriptions[lang] = get_description(lang)
117
+ @titles[lang] = get_title(lang) rescue ""
118
+ @descriptions[lang] = get_description(lang) rescue ""
119
119
  @lang_name = @language_hash[@lang]
120
120
  end
121
121
  end
@@ -125,7 +125,7 @@ module TedTalk
125
125
  unless @descriptions[lang]
126
126
  lang = "en"
127
127
  end
128
- puts "\nTitle:\n" + @titles["en"]
128
+ puts "\nTitle:\n" + @titles["en"]
129
129
  puts @titles[lang] if lang != "en"
130
130
  puts ""
131
131
  puts "Description:\n" + @descriptions[lang]
@@ -170,9 +170,8 @@ module TedTalk
170
170
  lang_url = "http://www.ted.com/talks/lang/#{lang}/" + @url_basename
171
171
  html = get_html(lang_url)
172
172
  lang_doc = Nokogiri::HTML(html)
173
- temp = lang_doc.xpath("//meta[@name='description']").first.attribute("content").value.strip
174
- /\ATED Talks\s*(.+)\z/ =~ temp
175
- $1 rescue temp ""
173
+ result = lang_doc.xpath("//meta[@name='description']").first.attribute("content").value.strip
174
+ return result || ""
176
175
  end
177
176
 
178
177
  def get_captions(lang = "en")
@@ -238,10 +237,10 @@ module TedTalk
238
237
  tag.title += " [x#{@speed}]" if @speed and @speed != 1
239
238
  tag.genre = "Talk"
240
239
 
241
- caption_text = @titles["en"] + "\n"
240
+ caption_text = @titles["en"] || ""
242
241
  caption_text << @titles[@lang] + "\n" if @titles[@lang]
243
242
  caption_text << "--------------------\n"
244
- caption_text << @descriptions["en"] + "\n"
243
+ caption_text << @descriptions["en"] + "\n" if @descriptions["en"]
245
244
  caption_text << @descriptions[@lang] + "\n" if @descriptions[@lang]
246
245
  caption_text << "\n"
247
246
  @captions["en"].each_with_index do |c, index|
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.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
12
+ date: 2013-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70364332347800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *70364332347800
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: progressbar
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70364332347380 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *70364332347380
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: json
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70364332346960 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70364332346960
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: taglib-ruby
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &70364328200660 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :runtime
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *70364328200660
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: nokogiri
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70364328199120 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :runtime
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *70364328199120
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: speak_slow
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70364328198040 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: '0'
102
77
  type: :runtime
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *70364328198040
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: trollop
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70364328196340 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,12 +87,7 @@ dependencies:
117
87
  version: '0'
118
88
  type: :runtime
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *70364328196340
126
91
  description: TedTalk helps download TED talk video and covert it to a slowed down
127
92
  MP3 with pauses that is useful for English learning
128
93
  email:
@@ -164,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
129
  version: '0'
165
130
  requirements: []
166
131
  rubyforge_project:
167
- rubygems_version: 1.8.24
132
+ rubygems_version: 1.8.17
168
133
  signing_key:
169
134
  specification_version: 3
170
135
  summary: TED talk downloader and converter for English learners