dropcaster 0.0.4 → 0.0.5.rc1
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.
- checksums.yaml +7 -0
- data/.document +5 -5
- data/.gitignore +14 -0
- data/.travis.yml +6 -0
- data/Gemfile +2 -13
- data/Gemfile.lock +94 -29
- data/Guardfile +12 -0
- data/LICENSE.txt +20 -20
- data/{README.md → README.markdown} +185 -171
- data/Rakefile +11 -47
- data/TODO +13 -12
- data/bin/dropcaster +129 -117
- data/bin/lstags +51 -45
- data/doc/sample-channel.yml +88 -81
- data/doc/sample-sidecar.yml +19 -19
- data/dropcaster.gemspec +36 -97
- data/lib/dropcaster/channel.rb +195 -159
- data/lib/dropcaster/channel_file_locator.rb +57 -57
- data/lib/dropcaster/errors.rb +25 -25
- data/lib/dropcaster/item.rb +28 -47
- data/lib/dropcaster/log_formatter.rb +9 -9
- data/lib/dropcaster/version.rb +3 -0
- data/lib/dropcaster.rb +28 -30
- data/templates/channel.html.erb +45 -43
- data/templates/channel.rss.erb +65 -64
- data/test/extensions/windows.rb +12 -12
- data/test/fixtures/channel.yml +16 -15
- data/test/fixtures/test_template.json.erb +40 -40
- data/test/helper.rb +10 -14
- data/test/unit/test_app.rb +129 -99
- data/test/unit/test_channel.rb +80 -73
- data/test/unit/test_channel_locator.rb +76 -93
- data/test/unit/test_channel_xml.rb +90 -89
- data/test/unit/test_item.rb +51 -63
- metadata +225 -158
- data/VERSION +0 -1
- data/lib/dropcaster/hashkeys.rb +0 -12
@@ -1,89 +1,90 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'xml/libxml'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
#
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
assert_equal('iTunes
|
35
|
-
assert_equal('iTunes
|
36
|
-
assert_equal('
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
assert_equal('
|
42
|
-
assert_equal('
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
assert_equal('
|
48
|
-
|
49
|
-
|
50
|
-
assert_equal('
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:
|
57
|
-
:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
assert_equal('
|
63
|
-
assert_equal('
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
assert_equal(@options[:
|
69
|
-
assert_equal(@options[:
|
70
|
-
assert_equal(@options[:
|
71
|
-
assert_equal(@options[:
|
72
|
-
assert_equal(@options[:
|
73
|
-
assert_equal(@options[:
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
assert_equal(@options[:owner][:
|
78
|
-
assert_equal(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
assert_equal(
|
84
|
-
assert_equal('
|
85
|
-
assert_equal('
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
require 'xml/libxml'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
class TestChannelXML < MiniTest::Test
|
6
|
+
include DropcasterTest
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@options = YAML.load_file(File.join(FIXTURES_DIR, Dropcaster::CHANNEL_YML))
|
10
|
+
@channel = channel_node(channel_rss)
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Returnes the XML node for the channel passed as XML string
|
15
|
+
#
|
16
|
+
def channel_node(rss)
|
17
|
+
XML::Document.string(rss).find("//rss/channel").first
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Returnes the channel under test as XML string
|
22
|
+
#
|
23
|
+
# Subclasses may overwrite this method in order to re-use the tests in this class, while
|
24
|
+
# constructing the XML string in a different way
|
25
|
+
#
|
26
|
+
def channel_rss
|
27
|
+
Dropcaster::Channel.new(FIXTURES_DIR, @options).to_rss
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_item
|
31
|
+
item = @channel.find("item").first
|
32
|
+
assert(item)
|
33
|
+
|
34
|
+
assert_equal('iTunes Name', item.find('title').first.content)
|
35
|
+
assert_equal('iTunes Artist', item.find('itunes:author', NS_ITUNES).first.content)
|
36
|
+
assert_equal('iTunes Description (Video Pane)', item.find('itunes:summary', NS_ITUNES).first.content)
|
37
|
+
assert_equal('http://www.example.com/podcasts/everything/AllAboutEverything.jpg', item.find('itunes:image', NS_ITUNES).first['href'])
|
38
|
+
|
39
|
+
enclosure = item.find('enclosure').first
|
40
|
+
assert(enclosure)
|
41
|
+
assert_equal('http://www.example.com/podcasts/everything/test/fixtures/iTunes.mp3', enclosure['url'])
|
42
|
+
assert_equal('58119', enclosure['length'])
|
43
|
+
assert_equal('audio/mp3', enclosure['type'])
|
44
|
+
|
45
|
+
guid = item.find('guid').first
|
46
|
+
assert(guid)
|
47
|
+
assert_equal('false', guid['isPermaLink'])
|
48
|
+
assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', guid.content)
|
49
|
+
|
50
|
+
assert_equal('Wed, 05 Oct 2011 13:32:26 -0600', item.find('pubDate').first.content)
|
51
|
+
assert_equal('3', item.find('itunes:duration', NS_ITUNES).first.content)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_attributes_mandatory
|
55
|
+
options = {:title => 'Test Channel',
|
56
|
+
:url => 'http://www.example.com/',
|
57
|
+
:description => 'A test channel',
|
58
|
+
:enclosures_url => 'http://www.example.com/foo/bar',
|
59
|
+
}
|
60
|
+
|
61
|
+
channel = channel_node(Dropcaster::Channel.new(FIXTURES_DIR, options).to_rss)
|
62
|
+
assert_equal('Test Channel', channel.find('title').first.content)
|
63
|
+
assert_equal('http://www.example.com/', channel.find('link').first.content)
|
64
|
+
assert_equal('A test channel', channel.find('description').first.content)
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_attributes_complete
|
68
|
+
assert_equal(@options[:title], @channel.find('title').first.content)
|
69
|
+
assert_equal(@options[:url], @channel.find('link').first.content)
|
70
|
+
assert_equal(@options[:description], @channel.find('description').first.content)
|
71
|
+
assert_equal(@options[:subtitle], @channel.find('itunes:subtitle', NS_ITUNES).first.content)
|
72
|
+
assert_equal(@options[:language], @channel.find('language').first.content)
|
73
|
+
assert_equal(@options[:copyright], @channel.find('copyright').first.content)
|
74
|
+
assert_equal(@options[:author], @channel.find('itunes:author', NS_ITUNES).first.content)
|
75
|
+
|
76
|
+
owner = @channel.find('itunes:owner', NS_ITUNES).first
|
77
|
+
assert_equal(@options[:owner][:name], owner.find('itunes:name', NS_ITUNES).first.content)
|
78
|
+
assert_equal(@options[:owner][:email], owner.find('itunes:email', NS_ITUNES).first.content)
|
79
|
+
assert_equal(URI.join(@options[:url], @options[:image_url]).to_s, @channel.find('itunes:image', NS_ITUNES).first['href'])
|
80
|
+
|
81
|
+
categories = @channel.find('itunes:category', NS_ITUNES)
|
82
|
+
refute_nil(categories)
|
83
|
+
assert_equal(2, categories.size)
|
84
|
+
assert_equal('Technology', categories.first['text'])
|
85
|
+
assert_equal('Gadgets', categories.first.find('itunes:category', NS_ITUNES).first['text'])
|
86
|
+
assert_equal('TV & Film', categories.last['text'])
|
87
|
+
|
88
|
+
assert_equal(@options[:explicit] ? 'Yes' : 'No', @channel.find('itunes:explicit', NS_ITUNES).first.content)
|
89
|
+
end
|
90
|
+
end
|
data/test/unit/test_item.rb
CHANGED
@@ -1,63 +1,51 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestItem < Test
|
4
|
-
include DropcasterTest
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_basics
|
11
|
-
assert_in_delta(3, @item.duration, 0.005)
|
12
|
-
assert_equal(58119, @item.file_size)
|
13
|
-
assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', @item.uuid)
|
14
|
-
assert_equal(
|
15
|
-
assert_equal('test/fixtures/iTunes.mp3', @item.file_name)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_tag
|
19
|
-
assert_equal('iTunes Artist', @item.tag.artist)
|
20
|
-
assert_equal('iTunes Genre', @item.tag.genre_s)
|
21
|
-
assert_equal('iTunes Name', @item.tag.title)
|
22
|
-
assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag.comments)
|
23
|
-
assert_equal('iTunes Album', @item.tag.album)
|
24
|
-
assert_equal(1970, @item.tag.year)
|
25
|
-
assert_equal(42, @item.tag.tracknum)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_tag2
|
29
|
-
assert_equal('iTunes Artist', @item.tag2.TP1)
|
30
|
-
assert_equal('iTunes Genre', @item.tag2.TCO)
|
31
|
-
assert_equal('iTunes Name', @item.tag2.TT2)
|
32
|
-
assert_equal('iTunes Album', @item.tag2.TAL)
|
33
|
-
assert_equal('1970', @item.tag2.TYE)
|
34
|
-
assert_equal('iTunes Album Artist', @item.tag2.TP2)
|
35
|
-
assert_equal('111', @item.tag2.TBP)
|
36
|
-
assert_equal('42/99', @item.tag2.TRK)
|
37
|
-
assert_equal('11', @item.tag2.TPA)
|
38
|
-
assert_equal('iTunes Grouping', @item.tag2.TT1)
|
39
|
-
assert_equal('iTunes Description (Video Pane)', @item.tag2.TT3)
|
40
|
-
assert_equal('iTunes Composer', @item.tag2.TCM)
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_lyrics
|
44
|
-
assert_equal(1, @item.lyrics.size)
|
45
|
-
assert_equal("iTunes Lyrics Line 1\niTunes Lyrics Line 2", @item.lyrics['eng'])
|
46
|
-
end
|
47
|
-
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
def test_comment_leave_itunes_crap
|
54
|
-
item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3, {:strip_itunes_private => false})
|
55
|
-
assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', item.tag2.COM[0])
|
56
|
-
assert_equal('iTunes Comments (Info Pane)', item.tag2.COM[1])
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_tag2_comment
|
60
|
-
assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag2.COM[0])
|
61
|
-
assert_equal('iTunes Comments (Info Pane)', @item.tag2.COM[1])
|
62
|
-
end
|
63
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestItem < MiniTest::Test
|
4
|
+
include DropcasterTest
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@item = Dropcaster::Item.new(FIXTURE_ITUNES_MP3)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_basics
|
11
|
+
assert_in_delta(3, @item.duration, 0.005)
|
12
|
+
assert_equal(58119, @item.file_size)
|
13
|
+
assert_equal('77bf84447c0f69ce4a33a18b0ae1e030b82010de', @item.uuid)
|
14
|
+
assert_equal(1392932984, @item.pub_date.to_i)
|
15
|
+
assert_equal('test/fixtures/iTunes.mp3', @item.file_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_tag
|
19
|
+
assert_equal('iTunes Artist', @item.tag.artist)
|
20
|
+
assert_equal('iTunes Genre', @item.tag.genre_s)
|
21
|
+
assert_equal('iTunes Name', @item.tag.title)
|
22
|
+
assert_equal(' 00007032 00006EA2 0000A049 00009735 00000559 0000096E 00008000 00008000 00000017 00000017', @item.tag.comments)
|
23
|
+
assert_equal('iTunes Album', @item.tag.album)
|
24
|
+
assert_equal(1970, @item.tag.year)
|
25
|
+
assert_equal(42, @item.tag.tracknum)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_tag2
|
29
|
+
assert_equal('iTunes Artist', @item.tag2.TP1)
|
30
|
+
assert_equal('iTunes Genre', @item.tag2.TCO)
|
31
|
+
assert_equal('iTunes Name', @item.tag2.TT2)
|
32
|
+
assert_equal('iTunes Album', @item.tag2.TAL)
|
33
|
+
assert_equal('1970', @item.tag2.TYE)
|
34
|
+
assert_equal('iTunes Album Artist', @item.tag2.TP2)
|
35
|
+
assert_equal('111', @item.tag2.TBP)
|
36
|
+
assert_equal('42/99', @item.tag2.TRK)
|
37
|
+
assert_equal('11', @item.tag2.TPA)
|
38
|
+
assert_equal('iTunes Grouping', @item.tag2.TT1)
|
39
|
+
assert_equal('iTunes Description (Video Pane)', @item.tag2.TT3)
|
40
|
+
assert_equal('iTunes Composer', @item.tag2.TCM)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_lyrics
|
44
|
+
assert_equal(1, @item.lyrics.size)
|
45
|
+
assert_equal("iTunes Lyrics Line 1\niTunes Lyrics Line 2", @item.lyrics['eng'])
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_tag2_comment
|
49
|
+
assert_equal('iTunes Comments (Info Pane)', @item.tag2.COM[1])
|
50
|
+
end
|
51
|
+
end
|