rubypodder 0.1.4 → 1.0.0
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/Rakefile +1 -1
- data/lib/rubypodder.rb +12 -4
- data/tests/tc_rubypodder.rb +20 -0
- data/tests/tc_stdout.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.name = "rubypodder"
|
7
|
-
s.version = "0.
|
7
|
+
s.version = "1.0.0"
|
8
8
|
s.author = "Lex Miller"
|
9
9
|
s.email = "lex.miller @nospam@ gmail.com"
|
10
10
|
s.summary = "A podcast aggregator without an interface"
|
data/lib/rubypodder.rb
CHANGED
@@ -17,7 +17,7 @@ end
|
|
17
17
|
|
18
18
|
class RubyPodder
|
19
19
|
|
20
|
-
Version = 'rubypodder
|
20
|
+
Version = 'rubypodder v1.0.0'
|
21
21
|
|
22
22
|
attr_reader :conf_file, :log_file, :done_file, :date_dir
|
23
23
|
|
@@ -90,6 +90,16 @@ class RubyPodder
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
def download_all(items)
|
94
|
+
items.each do |item|
|
95
|
+
begin
|
96
|
+
download(item.enclosure.url)
|
97
|
+
rescue
|
98
|
+
@log.warn(" No media to download for this item")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
93
103
|
def remove_dir_if_empty(dirname)
|
94
104
|
begin
|
95
105
|
Dir.rmdir(dirname)
|
@@ -116,9 +126,7 @@ class RubyPodder
|
|
116
126
|
next
|
117
127
|
end
|
118
128
|
@log.info("Channel: #{rss.channel.title}")
|
119
|
-
rss.items
|
120
|
-
download(item.enclosure.url)
|
121
|
-
end
|
129
|
+
download_all(rss.items)
|
122
130
|
end
|
123
131
|
remove_dir_if_empty(@date_dir)
|
124
132
|
@log.info("Finished")
|
data/tests/tc_rubypodder.rb
CHANGED
@@ -150,6 +150,26 @@ class TC_RubyPodder < Test::Unit::TestCase
|
|
150
150
|
assert_equal("http://podcast.rickygervais.com/guspecials_halloween.mp3", rss.items[0].enclosure.url)
|
151
151
|
end
|
152
152
|
|
153
|
+
def test_item_with_no_enclosure
|
154
|
+
rss_source = <<-END_OF_STRING
|
155
|
+
<?xml version="1.0" encoding="utf-8"?>
|
156
|
+
<rss>
|
157
|
+
<channel>
|
158
|
+
<title>The Ricky Gervais Show</title>
|
159
|
+
<item>
|
160
|
+
<title>The Podfather Part I - Halloween</title>
|
161
|
+
</item>
|
162
|
+
</channel>
|
163
|
+
</rss>
|
164
|
+
END_OF_STRING
|
165
|
+
|
166
|
+
# Code here to test that a run doesn't throw an exception if there is no enclosure.
|
167
|
+
# (Remove enclosure from the above test XML)
|
168
|
+
#
|
169
|
+
rss = @rp.parse_rss(rss_source)
|
170
|
+
assert_nothing_raised { @rp.download_all(rss.items) }
|
171
|
+
end
|
172
|
+
|
153
173
|
def test_dest_file_name(url)
|
154
174
|
correct_dest_file_name = @rp.date_dir + "/" + "podcast.mp3"
|
155
175
|
dest_file_name = @rp.dest_file_name("http://www.podcast.com/podcast.mp3")
|
data/tests/tc_stdout.rb
CHANGED
@@ -40,7 +40,7 @@ class TC_stdout < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_version
|
43
|
-
assert_equal "rubypodder
|
43
|
+
assert_equal "rubypodder v1.0.0\n", wrap { puts `ruby #{@bindir}/rubypodder --version` }
|
44
44
|
assert exits_without_doing_anything { `ruby #{@bindir}/rubypodder --version` }, "--version doesn't exit immediately"
|
45
45
|
end
|
46
46
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rubypodder
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-09-12 00:00:00 +09:00
|
8
8
|
summary: A podcast aggregator without an interface
|
9
9
|
require_paths:
|
10
10
|
- lib
|