xspf 0.3 → 0.4
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/AUTHORS +1 -1
- data/ChangeLog +15 -0
- data/README +6 -9
- data/USAGE +350 -0
- data/coverage/index.html +17 -17
- data/coverage/lib-xspf_rb.html +466 -305
- data/doc/created.rid +1 -1
- data/doc/fr_file_index.html +4 -0
- data/doc/fr_method_index.html +88 -44
- data/doc/index.html +1 -1
- data/examples/parse_and_generate_right.rb +25 -0
- data/examples/parse_and_generate_right_too.rb +27 -0
- data/examples/parse_and_generate_wrong.rb +25 -0
- data/examples/{example.rb → parse_from_file.rb} +15 -16
- data/examples/parse_from_string.rb +70 -0
- data/examples/playlist-tiersen.xspf +100 -0
- data/lib/xspf.rb +335 -174
- data/test/tc_dogfood.rb +106 -0
- data/test/tc_generate_output_formats.rb +352 -0
- data/test/tc_generate_playlist.rb +196 -0
- data/test/tc_generate_track.rb +38 -0
- data/test/tc_generate_tracklist.rb +72 -0
- data/test/tc_generate_xspf.rb +90 -0
- data/test/{tc_output_formats.rb → tc_parse_output_formats.rb} +124 -9
- data/test/{tc_playlist.rb → tc_parse_playlist.rb} +9 -1
- data/test/{tc_track.rb → tc_parse_track.rb} +1 -1
- data/test/{tc_tracklist.rb → tc_parse_tracklist.rb} +1 -1
- data/test/{tc_xspf.rb → tc_parse_xspf.rb} +4 -3
- data/test/ts_xspf.rb +12 -5
- data/xspf-expanded.rb +644 -76
- metadata +30 -16
data/test/tc_dogfood.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
+
|
3
|
+
require 'xspf'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestDogfood < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@xspf_document = "<?xml version='1.0' encoding='UTF-8'?><playlist version='1' xmlns='http://xspf.org/ns/0/'><title>Tout est calme</title><creator>Yann Tiersen</creator><info>http://www.yanntiersen.com/</info><license>Redistribution or sharing not allowed</license><meta rel='http://www.example.org/key'>value</meta><trackList><track><location>http://some.nifty.locati.on/file1.ogg</location><identifier>http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83</identifier><title>Plus au sud</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>1</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file2.ogg</location><identifier>http://musicbrainz.org/track/eba1a9a9-1810-41f1-8cc9-2a00dda0a68c</identifier><title>Les Grandes Marées</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>2</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file3.ogg</location><identifier>http://musicbrainz.org/track/0c18ef8c-04fa-47d5-b078-66ab6a819a83</identifier><title>La Crise</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>3</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file4.ogg</location><identifier> http://musicbrainz.org/track/0f66dd52-bda0-4526-979d-af95ac637cc4</identifier><title>Tout est calme</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>4</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file5.ogg</location><identifier> http://musicbrainz.org/track/a06ef58e-019e-409a-bf72-9bd080012ac3</identifier><title>La Rupture</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>5</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file6.ogg</location><identifier>http://musicbrainz.org/track/f82c0a06-d4a8-41a5-9238-029e38fa9d7c</identifier><title>La Relève</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>6</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file7.ogg</location><identifier>http://musicbrainz.org/track/97591e2b-967e-47eb-b2b3-9a450cd33352</identifier><title>La Pharmacie</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>7</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file8.ogg</location><identifier>http://musicbrainz.org/track/ae7f8502-778d-4f5e-9dba-6fc5d553ad0e</identifier><title>La Terrasse</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>8</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file9.ogg</location><identifier>http://musicbrainz.org/track/6e937503-9d01-428c-84b5-1200bab9d1c6</identifier><title>L\303\211tal</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>9</trackNum><meta rel='http://www.example.org/key'>value</meta></track><track><location>http://some.nifty.locati.on/file10.ogg</location><identifier>http://musicbrainz.org/track/2c4c845c-907a-4d96-940a-bbe8b2d0f126</identifier><title>La Découverte</title><creator>Yann Tiersen</creator><album>Tout est calme</album><trackNum>10</trackNum><meta rel='http://www.example.org/key'>value</meta></track></trackList></playlist>"
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_generate_from_parsed
|
13
|
+
|
14
|
+
xspf = XSPF.new(@xspf_document)
|
15
|
+
playlist = XSPF::Playlist.new(xspf)
|
16
|
+
tracklist = XSPF::Tracklist.new(playlist)
|
17
|
+
tracks = tracklist.tracks
|
18
|
+
|
19
|
+
generated_tracklist = XSPF::Tracklist.new
|
20
|
+
tracks.each { |t| generated_tracklist << t }
|
21
|
+
assert_instance_of(XSPF::Tracklist, generated_tracklist)
|
22
|
+
|
23
|
+
generated_playlist = XSPF::Playlist.new( { :xmlns => playlist.xmlns, :version => playlist.version, :title => playlist.title, :creator => playlist.creator, :info => playlist.info, :license => playlist.license, :meta_rel => playlist.meta_rel, :meta_content => playlist.meta_content, :tracklist => generated_tracklist })
|
24
|
+
assert_instance_of(XSPF::Playlist, generated_playlist)
|
25
|
+
assert_equal(playlist.xmlns, generated_playlist.xmlns)
|
26
|
+
assert_equal(playlist.version, generated_playlist.version)
|
27
|
+
assert_equal(playlist.title, generated_playlist.title)
|
28
|
+
assert_equal(playlist.creator, generated_playlist.creator)
|
29
|
+
assert_equal(playlist.info, generated_playlist.info)
|
30
|
+
assert_equal(playlist.license, generated_playlist.license)
|
31
|
+
assert_equal(playlist.meta_rel, generated_playlist.meta_rel)
|
32
|
+
assert_equal(playlist.meta_content, generated_playlist.meta_content)
|
33
|
+
|
34
|
+
generated_xspf = XSPF.new( { :version => xspf.version, :encoding => xspf.encoding, :playlist => generated_playlist } )
|
35
|
+
assert_instance_of(XSPF, generated_xspf)
|
36
|
+
assert_equal(xspf.version, generated_xspf.version)
|
37
|
+
assert_equal(xspf.encoding, generated_xspf.encoding)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_parse_from_generated
|
42
|
+
|
43
|
+
track1 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file1.ogg', :identifier => 'http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83', :title => 'Plus au sud', :creator => 'Yann Tiersen', :tracknum => '1', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
44
|
+
|
45
|
+
track2 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file2.ogg', :identifier => 'http://musicbrainz.org/track/eba1a9a9-1810-41f1-8cc9-2a00dda0a68c', :title => 'Les Grandes Marées', :creator => 'Yann Tiersen', :tracknum => '2', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
46
|
+
|
47
|
+
track3 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file3.ogg', :identifier => 'http://musicbrainz.org/track/0c18ef8c-04fa-47d5-b078-66ab6a819a83', :title => 'La Crise', :creator => 'Yann Tiersen', :tracknum => '3', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
48
|
+
|
49
|
+
track4 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file4.ogg', :identifier => ' http://musicbrainz.org/track/0f66dd52-bda0-4526-979d-af95ac637cc4', :title => 'Tout est calme', :creator => 'Yann Tiersen', :tracknum => '4', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
50
|
+
|
51
|
+
track5 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file5.ogg', :identifier => ' http://musicbrainz.org/track/a06ef58e-019e-409a-bf72-9bd080012ac3', :title => 'La Rupture', :creator => 'Yann Tiersen', :tracknum => '5', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
52
|
+
|
53
|
+
track6 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file6.ogg', :identifier => 'http://musicbrainz.org/track/f82c0a06-d4a8-41a5-9238-029e38fa9d7c', :title => 'La Relève', :creator => 'Yann Tiersen', :tracknum => '6', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
54
|
+
|
55
|
+
track7 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file7.ogg', :identifier => 'http://musicbrainz.org/track/97591e2b-967e-47eb-b2b3-9a450cd33352', :title => 'La Pharmacie', :creator => 'Yann Tiersen', :tracknum => '7', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
56
|
+
|
57
|
+
track8 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file8.ogg', :identifier => 'http://musicbrainz.org/track/ae7f8502-778d-4f5e-9dba-6fc5d553ad0e', :title => 'La Terrasse', :creator => 'Yann Tiersen', :tracknum => '8', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
58
|
+
|
59
|
+
track9 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file9.ogg', :identifier => 'http://musicbrainz.org/track/6e937503-9d01-428c-84b5-1200bab9d1c6', :title => "L''Étal", :creator => 'Yann Tiersen', :tracknum => '9', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
60
|
+
|
61
|
+
track10 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file10.ogg', :identifier => 'http://musicbrainz.org/track/2c4c845c-907a-4d96-940a-bbe8b2d0f126', :title => 'La Découverte', :creator => 'Yann Tiersen', :tracknum => '10', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
62
|
+
|
63
|
+
tracklist = XSPF::Tracklist.new
|
64
|
+
|
65
|
+
tracklist << track1
|
66
|
+
tracklist << track2
|
67
|
+
tracklist << track3
|
68
|
+
tracklist << track4
|
69
|
+
tracklist << track5
|
70
|
+
tracklist << track6
|
71
|
+
tracklist << track7
|
72
|
+
tracklist << track8
|
73
|
+
tracklist << track9
|
74
|
+
tracklist << track10
|
75
|
+
|
76
|
+
playlist = XSPF::Playlist.new( {:xmlns => 'http://xspf.org/ns/0/', :title => 'Tout est calme', :creator => 'Yann Tiersen', :license => 'Redistribution or sharing not allowed', :info => 'http://www.yanntiersen.com/', :tracklist => tracklist, :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
77
|
+
|
78
|
+
xspf = XSPF.new( { :playlist => playlist } )
|
79
|
+
|
80
|
+
xml = xspf.to_xml
|
81
|
+
|
82
|
+
parsed_xspf = XSPF.new(xml)
|
83
|
+
assert_instance_of(XSPF, parsed_xspf)
|
84
|
+
assert_equal(xspf.version, parsed_xspf.version)
|
85
|
+
assert_equal(xspf.encoding, parsed_xspf.encoding)
|
86
|
+
|
87
|
+
parsed_playlist = XSPF::Playlist.new(parsed_xspf)
|
88
|
+
assert_instance_of(XSPF::Playlist, parsed_playlist)
|
89
|
+
assert_equal(playlist.xmlns, parsed_playlist.xmlns)
|
90
|
+
assert_equal(playlist.version, parsed_playlist.version)
|
91
|
+
assert_equal(playlist.title, parsed_playlist.title)
|
92
|
+
assert_equal(playlist.creator, parsed_playlist.creator)
|
93
|
+
assert_equal(playlist.info, parsed_playlist.info)
|
94
|
+
assert_equal(playlist.license, parsed_playlist.license)
|
95
|
+
assert_equal(playlist.meta_rel, parsed_playlist.meta_rel)
|
96
|
+
assert_equal(playlist.meta_content, parsed_playlist.meta_content)
|
97
|
+
|
98
|
+
parsed_tracklist = XSPF::Tracklist.new(parsed_playlist)
|
99
|
+
assert_instance_of(XSPF::Tracklist, parsed_tracklist)
|
100
|
+
|
101
|
+
parsed_tracks = parsed_tracklist.tracks
|
102
|
+
parsed_tracks.each { |t| assert_instance_of(XSPF::Track, t) }
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +1,352 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
+
|
3
|
+
require 'xspf'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestOuputFormats < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
|
10
|
+
track1 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file1.ogg', :identifier => 'http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83', :title => 'Plus au sud', :creator => 'Yann Tiersen', :tracknum => '1', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
11
|
+
|
12
|
+
track2 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file2.ogg', :identifier => 'http://musicbrainz.org/track/eba1a9a9-1810-41f1-8cc9-2a00dda0a68c', :title => 'Les Grandes Marées', :creator => 'Yann Tiersen', :tracknum => '2', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
13
|
+
|
14
|
+
track3 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file3.ogg', :identifier => 'http://musicbrainz.org/track/0c18ef8c-04fa-47d5-b078-66ab6a819a83', :title => 'La Crise', :creator => 'Yann Tiersen', :tracknum => '3', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
15
|
+
|
16
|
+
track4 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file4.ogg', :identifier => ' http://musicbrainz.org/track/0f66dd52-bda0-4526-979d-af95ac637cc4', :title => 'Tout est calme', :creator => 'Yann Tiersen', :tracknum => '4', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
17
|
+
|
18
|
+
track5 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file5.ogg', :identifier => ' http://musicbrainz.org/track/a06ef58e-019e-409a-bf72-9bd080012ac3', :title => 'La Rupture', :creator => 'Yann Tiersen', :tracknum => '5', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
19
|
+
|
20
|
+
track6 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file6.ogg', :identifier => 'http://musicbrainz.org/track/f82c0a06-d4a8-41a5-9238-029e38fa9d7c', :title => 'La Relève', :creator => 'Yann Tiersen', :tracknum => '6', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
21
|
+
|
22
|
+
track7 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file7.ogg', :identifier => 'http://musicbrainz.org/track/97591e2b-967e-47eb-b2b3-9a450cd33352', :title => 'La Pharmacie', :creator => 'Yann Tiersen', :tracknum => '7', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
23
|
+
|
24
|
+
track8 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file8.ogg', :identifier => 'http://musicbrainz.org/track/ae7f8502-778d-4f5e-9dba-6fc5d553ad0e', :title => 'La Terrasse', :creator => 'Yann Tiersen', :tracknum => '8', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
25
|
+
|
26
|
+
track9 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file9.ogg', :identifier => 'http://musicbrainz.org/track/6e937503-9d01-428c-84b5-1200bab9d1c6', :title => "L''Étal", :creator => 'Yann Tiersen', :tracknum => '9', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
27
|
+
|
28
|
+
track10 = XSPF::Track.new( { :location => 'http://some.nifty.locati.on/file10.ogg', :identifier => 'http://musicbrainz.org/track/2c4c845c-907a-4d96-940a-bbe8b2d0f126', :title => 'La Découverte', :creator => 'Yann Tiersen', :tracknum => '10', :album => 'Tout est calme', :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
29
|
+
|
30
|
+
tracklist = XSPF::Tracklist.new
|
31
|
+
|
32
|
+
tracklist << track1
|
33
|
+
tracklist << track2
|
34
|
+
tracklist << track3
|
35
|
+
tracklist << track4
|
36
|
+
tracklist << track5
|
37
|
+
tracklist << track6
|
38
|
+
tracklist << track7
|
39
|
+
tracklist << track8
|
40
|
+
tracklist << track9
|
41
|
+
tracklist << track10
|
42
|
+
|
43
|
+
playlist = XSPF::Playlist.new( {:xmlns => 'http://xspf.org/ns/0/', :title => 'Tout est calme', :creator => 'Yann Tiersen', :license => 'Redistribution or sharing not allowed', :info => 'http://www.yanntiersen.com/', :tracklist => tracklist, :meta_rel => 'http://www.example.org/key', :meta_content => 'value' } )
|
44
|
+
|
45
|
+
@xspf = XSPF.new( { :playlist => playlist } )
|
46
|
+
|
47
|
+
@expected_m3u_output = <<END_OF_M3U
|
48
|
+
http://some.nifty.locati.on/file1.ogg
|
49
|
+
http://some.nifty.locati.on/file2.ogg
|
50
|
+
http://some.nifty.locati.on/file3.ogg
|
51
|
+
http://some.nifty.locati.on/file4.ogg
|
52
|
+
http://some.nifty.locati.on/file5.ogg
|
53
|
+
http://some.nifty.locati.on/file6.ogg
|
54
|
+
http://some.nifty.locati.on/file7.ogg
|
55
|
+
http://some.nifty.locati.on/file8.ogg
|
56
|
+
http://some.nifty.locati.on/file9.ogg
|
57
|
+
http://some.nifty.locati.on/file10.ogg
|
58
|
+
END_OF_M3U
|
59
|
+
|
60
|
+
@expected_smil_output = <<END_OF_SMIL
|
61
|
+
<?xml version="1.0"?>
|
62
|
+
<smil xmlns:xspf="http://xspf.org/ns/0/">
|
63
|
+
<body>
|
64
|
+
<seq>
|
65
|
+
<audio src="http://some.nifty.locati.on/file1.ogg"/>
|
66
|
+
<audio src="http://some.nifty.locati.on/file2.ogg"/>
|
67
|
+
<audio src="http://some.nifty.locati.on/file3.ogg"/>
|
68
|
+
<audio src="http://some.nifty.locati.on/file4.ogg"/>
|
69
|
+
<audio src="http://some.nifty.locati.on/file5.ogg"/>
|
70
|
+
<audio src="http://some.nifty.locati.on/file6.ogg"/>
|
71
|
+
<audio src="http://some.nifty.locati.on/file7.ogg"/>
|
72
|
+
<audio src="http://some.nifty.locati.on/file8.ogg"/>
|
73
|
+
<audio src="http://some.nifty.locati.on/file9.ogg"/>
|
74
|
+
<audio src="http://some.nifty.locati.on/file10.ogg"/>
|
75
|
+
</seq>
|
76
|
+
</body>
|
77
|
+
</smil>
|
78
|
+
END_OF_SMIL
|
79
|
+
|
80
|
+
@expected_html_ouput = <<END_OF_HTML
|
81
|
+
<html xmlns:xspf="http://xspf.org/ns/0/">
|
82
|
+
<head>
|
83
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
84
|
+
<title>Tout est calme</title>
|
85
|
+
<link href="http://www.w3.org/StyleSheets/Core/Modernist" rel="stylesheet" type="text/css" media="screen">
|
86
|
+
<style type="text/css">
|
87
|
+
dl {
|
88
|
+
margin-bottom: 5px;
|
89
|
+
}
|
90
|
+
|
91
|
+
.track {
|
92
|
+
}
|
93
|
+
|
94
|
+
.location {
|
95
|
+
}
|
96
|
+
|
97
|
+
.creator {
|
98
|
+
}
|
99
|
+
|
100
|
+
.top {
|
101
|
+
}
|
102
|
+
|
103
|
+
.duration {
|
104
|
+
}
|
105
|
+
|
106
|
+
.trackList {
|
107
|
+
}
|
108
|
+
|
109
|
+
.info {
|
110
|
+
}
|
111
|
+
|
112
|
+
.annotation {
|
113
|
+
}
|
114
|
+
|
115
|
+
.attribution {
|
116
|
+
}
|
117
|
+
|
118
|
+
.image {
|
119
|
+
}
|
120
|
+
|
121
|
+
.meta {
|
122
|
+
}
|
123
|
+
|
124
|
+
.license {
|
125
|
+
}
|
126
|
+
|
127
|
+
.trackNum {
|
128
|
+
}
|
129
|
+
|
130
|
+
.date {
|
131
|
+
}
|
132
|
+
|
133
|
+
.identifier {
|
134
|
+
}
|
135
|
+
|
136
|
+
.link {
|
137
|
+
}
|
138
|
+
|
139
|
+
|
140
|
+
</style>
|
141
|
+
</head>
|
142
|
+
<body>
|
143
|
+
<h1>Tout est calme</h1>
|
144
|
+
<dl class="top">
|
145
|
+
<dt class="creator">creator</dt>
|
146
|
+
<dd class="creator">Yann Tiersen</dd>
|
147
|
+
<dt class="info">info</dt>
|
148
|
+
<dd class="info"><a href="http://www.yanntiersen.com/">http://www.yanntiersen.com/</a></dd>
|
149
|
+
<dt class="license">license</dt>
|
150
|
+
<dd class="license"><a href="Redistribution%20or%20sharing%20not%20allowed">Redistribution or sharing not allowed</a></dd>
|
151
|
+
<dt class="meta">meta</dt>
|
152
|
+
<dd class="meta"><a href="value">value</a></dd>
|
153
|
+
<dt class="trackList">trackList</dt>
|
154
|
+
<dd class="trackList"><ol>
|
155
|
+
<li><dl class="track">
|
156
|
+
<dt class="location">location</dt>
|
157
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file1.ogg">http://some.nifty.locati.on/file1.ogg</a></dd>
|
158
|
+
<dt class="identifier">identifier</dt>
|
159
|
+
<dd class="identifier">http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83</dd>
|
160
|
+
<dt class="creator">creator</dt>
|
161
|
+
<dd class="creator">Yann Tiersen</dd>
|
162
|
+
<dt class="trackNum">trackNum</dt>
|
163
|
+
<dd class="trackNum">1</dd>
|
164
|
+
<dt class="meta">meta</dt>
|
165
|
+
<dd class="meta"><a href="value">value</a></dd>
|
166
|
+
</dl></li>
|
167
|
+
<li><dl class="track">
|
168
|
+
<dt class="location">location</dt>
|
169
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file2.ogg">http://some.nifty.locati.on/file2.ogg</a></dd>
|
170
|
+
<dt class="identifier">identifier</dt>
|
171
|
+
<dd class="identifier">http://musicbrainz.org/track/eba1a9a9-1810-41f1-8cc9-2a00dda0a68c</dd>
|
172
|
+
<dt class="creator">creator</dt>
|
173
|
+
<dd class="creator">Yann Tiersen</dd>
|
174
|
+
<dt class="trackNum">trackNum</dt>
|
175
|
+
<dd class="trackNum">2</dd>
|
176
|
+
<dt class="meta">meta</dt>
|
177
|
+
<dd class="meta"><a href="value">value</a></dd>
|
178
|
+
</dl></li>
|
179
|
+
<li><dl class="track">
|
180
|
+
<dt class="location">location</dt>
|
181
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file3.ogg">http://some.nifty.locati.on/file3.ogg</a></dd>
|
182
|
+
<dt class="identifier">identifier</dt>
|
183
|
+
<dd class="identifier">http://musicbrainz.org/track/0c18ef8c-04fa-47d5-b078-66ab6a819a83</dd>
|
184
|
+
<dt class="creator">creator</dt>
|
185
|
+
<dd class="creator">Yann Tiersen</dd>
|
186
|
+
<dt class="trackNum">trackNum</dt>
|
187
|
+
<dd class="trackNum">3</dd>
|
188
|
+
<dt class="meta">meta</dt>
|
189
|
+
<dd class="meta"><a href="value">value</a></dd>
|
190
|
+
</dl></li>
|
191
|
+
<li><dl class="track">
|
192
|
+
<dt class="location">location</dt>
|
193
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file4.ogg">http://some.nifty.locati.on/file4.ogg</a></dd>
|
194
|
+
<dt class="identifier">identifier</dt>
|
195
|
+
<dd class="identifier"> http://musicbrainz.org/track/0f66dd52-bda0-4526-979d-af95ac637cc4</dd>
|
196
|
+
<dt class="creator">creator</dt>
|
197
|
+
<dd class="creator">Yann Tiersen</dd>
|
198
|
+
<dt class="trackNum">trackNum</dt>
|
199
|
+
<dd class="trackNum">4</dd>
|
200
|
+
<dt class="meta">meta</dt>
|
201
|
+
<dd class="meta"><a href="value">value</a></dd>
|
202
|
+
</dl></li>
|
203
|
+
<li><dl class="track">
|
204
|
+
<dt class="location">location</dt>
|
205
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file5.ogg">http://some.nifty.locati.on/file5.ogg</a></dd>
|
206
|
+
<dt class="identifier">identifier</dt>
|
207
|
+
<dd class="identifier"> http://musicbrainz.org/track/a06ef58e-019e-409a-bf72-9bd080012ac3</dd>
|
208
|
+
<dt class="creator">creator</dt>
|
209
|
+
<dd class="creator">Yann Tiersen</dd>
|
210
|
+
<dt class="trackNum">trackNum</dt>
|
211
|
+
<dd class="trackNum">5</dd>
|
212
|
+
<dt class="meta">meta</dt>
|
213
|
+
<dd class="meta"><a href="value">value</a></dd>
|
214
|
+
</dl></li>
|
215
|
+
<li><dl class="track">
|
216
|
+
<dt class="location">location</dt>
|
217
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file6.ogg">http://some.nifty.locati.on/file6.ogg</a></dd>
|
218
|
+
<dt class="identifier">identifier</dt>
|
219
|
+
<dd class="identifier">http://musicbrainz.org/track/f82c0a06-d4a8-41a5-9238-029e38fa9d7c</dd>
|
220
|
+
<dt class="creator">creator</dt>
|
221
|
+
<dd class="creator">Yann Tiersen</dd>
|
222
|
+
<dt class="trackNum">trackNum</dt>
|
223
|
+
<dd class="trackNum">6</dd>
|
224
|
+
<dt class="meta">meta</dt>
|
225
|
+
<dd class="meta"><a href="value">value</a></dd>
|
226
|
+
</dl></li>
|
227
|
+
<li><dl class="track">
|
228
|
+
<dt class="location">location</dt>
|
229
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file7.ogg">http://some.nifty.locati.on/file7.ogg</a></dd>
|
230
|
+
<dt class="identifier">identifier</dt>
|
231
|
+
<dd class="identifier">http://musicbrainz.org/track/97591e2b-967e-47eb-b2b3-9a450cd33352</dd>
|
232
|
+
<dt class="creator">creator</dt>
|
233
|
+
<dd class="creator">Yann Tiersen</dd>
|
234
|
+
<dt class="trackNum">trackNum</dt>
|
235
|
+
<dd class="trackNum">7</dd>
|
236
|
+
<dt class="meta">meta</dt>
|
237
|
+
<dd class="meta"><a href="value">value</a></dd>
|
238
|
+
</dl></li>
|
239
|
+
<li><dl class="track">
|
240
|
+
<dt class="location">location</dt>
|
241
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file8.ogg">http://some.nifty.locati.on/file8.ogg</a></dd>
|
242
|
+
<dt class="identifier">identifier</dt>
|
243
|
+
<dd class="identifier">http://musicbrainz.org/track/ae7f8502-778d-4f5e-9dba-6fc5d553ad0e</dd>
|
244
|
+
<dt class="creator">creator</dt>
|
245
|
+
<dd class="creator">Yann Tiersen</dd>
|
246
|
+
<dt class="trackNum">trackNum</dt>
|
247
|
+
<dd class="trackNum">8</dd>
|
248
|
+
<dt class="meta">meta</dt>
|
249
|
+
<dd class="meta"><a href="value">value</a></dd>
|
250
|
+
</dl></li>
|
251
|
+
<li><dl class="track">
|
252
|
+
<dt class="location">location</dt>
|
253
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file9.ogg">http://some.nifty.locati.on/file9.ogg</a></dd>
|
254
|
+
<dt class="identifier">identifier</dt>
|
255
|
+
<dd class="identifier">http://musicbrainz.org/track/6e937503-9d01-428c-84b5-1200bab9d1c6</dd>
|
256
|
+
<dt class="creator">creator</dt>
|
257
|
+
<dd class="creator">Yann Tiersen</dd>
|
258
|
+
<dt class="trackNum">trackNum</dt>
|
259
|
+
<dd class="trackNum">9</dd>
|
260
|
+
<dt class="meta">meta</dt>
|
261
|
+
<dd class="meta"><a href="value">value</a></dd>
|
262
|
+
</dl></li>
|
263
|
+
<li><dl class="track">
|
264
|
+
<dt class="location">location</dt>
|
265
|
+
<dd class="location"><a href="http://some.nifty.locati.on/file10.ogg">http://some.nifty.locati.on/file10.ogg</a></dd>
|
266
|
+
<dt class="identifier">identifier</dt>
|
267
|
+
<dd class="identifier">http://musicbrainz.org/track/2c4c845c-907a-4d96-940a-bbe8b2d0f126</dd>
|
268
|
+
<dt class="creator">creator</dt>
|
269
|
+
<dd class="creator">Yann Tiersen</dd>
|
270
|
+
<dt class="trackNum">trackNum</dt>
|
271
|
+
<dd class="trackNum">10</dd>
|
272
|
+
<dt class="meta">meta</dt>
|
273
|
+
<dd class="meta"><a href="value">value</a></dd>
|
274
|
+
</dl></li>
|
275
|
+
</ol></dd>
|
276
|
+
</dl>
|
277
|
+
</body>
|
278
|
+
</html>
|
279
|
+
END_OF_HTML
|
280
|
+
|
281
|
+
|
282
|
+
@expected_soundblox_ouput = <<END_OF_SOUNDBLOX
|
283
|
+
<?xml version="1.0"?>
|
284
|
+
<soundbloxdata xmlns:xspf="http://xspf.org/ns/0/">
|
285
|
+
<customize autostart="false" startopen="true"/>
|
286
|
+
<playlist name="Tout est calme">
|
287
|
+
<track>
|
288
|
+
<mp3url>http://some.nifty.locati.on/file1.ogg</mp3url>
|
289
|
+
<downloadurl>http://some.nifty.locati.on/file1.ogg</downloadurl>
|
290
|
+
</track>
|
291
|
+
<track>
|
292
|
+
<mp3url>http://some.nifty.locati.on/file2.ogg</mp3url>
|
293
|
+
<downloadurl>http://some.nifty.locati.on/file2.ogg</downloadurl>
|
294
|
+
</track>
|
295
|
+
<track>
|
296
|
+
<mp3url>http://some.nifty.locati.on/file3.ogg</mp3url>
|
297
|
+
<downloadurl>http://some.nifty.locati.on/file3.ogg</downloadurl>
|
298
|
+
</track>
|
299
|
+
<track>
|
300
|
+
<mp3url>http://some.nifty.locati.on/file4.ogg</mp3url>
|
301
|
+
<downloadurl>http://some.nifty.locati.on/file4.ogg</downloadurl>
|
302
|
+
</track>
|
303
|
+
<track>
|
304
|
+
<mp3url>http://some.nifty.locati.on/file5.ogg</mp3url>
|
305
|
+
<downloadurl>http://some.nifty.locati.on/file5.ogg</downloadurl>
|
306
|
+
</track>
|
307
|
+
<track>
|
308
|
+
<mp3url>http://some.nifty.locati.on/file6.ogg</mp3url>
|
309
|
+
<downloadurl>http://some.nifty.locati.on/file6.ogg</downloadurl>
|
310
|
+
</track>
|
311
|
+
<track>
|
312
|
+
<mp3url>http://some.nifty.locati.on/file7.ogg</mp3url>
|
313
|
+
<downloadurl>http://some.nifty.locati.on/file7.ogg</downloadurl>
|
314
|
+
</track>
|
315
|
+
<track>
|
316
|
+
<mp3url>http://some.nifty.locati.on/file8.ogg</mp3url>
|
317
|
+
<downloadurl>http://some.nifty.locati.on/file8.ogg</downloadurl>
|
318
|
+
</track>
|
319
|
+
<track>
|
320
|
+
<mp3url>http://some.nifty.locati.on/file9.ogg</mp3url>
|
321
|
+
<downloadurl>http://some.nifty.locati.on/file9.ogg</downloadurl>
|
322
|
+
</track>
|
323
|
+
<track>
|
324
|
+
<mp3url>http://some.nifty.locati.on/file10.ogg</mp3url>
|
325
|
+
<downloadurl>http://some.nifty.locati.on/file10.ogg</downloadurl>
|
326
|
+
</track>
|
327
|
+
</playlist>
|
328
|
+
</soundbloxdata>
|
329
|
+
END_OF_SOUNDBLOX
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
def test_m3u
|
334
|
+
assert_equal(@expected_m3u_output, @xspf.to_m3u)
|
335
|
+
end
|
336
|
+
|
337
|
+
def test_smil
|
338
|
+
assert_equal(@expected_smil_output, @xspf.to_smil)
|
339
|
+
end
|
340
|
+
|
341
|
+
def test_html
|
342
|
+
assert_equal(@expected_html_ouput, @xspf.to_html)
|
343
|
+
end
|
344
|
+
|
345
|
+
def test_soundblox
|
346
|
+
assert_equal(@expected_soundblox_ouput, @xspf.to_soundblox)
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_error
|
350
|
+
assert_raise(NoMethodError) { @xspf.to_other_format }
|
351
|
+
end
|
352
|
+
end
|