xspf 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Mon Oct 30 22:55:30 CET 2006
|
data/doc/fr_file_index.html
CHANGED
@@ -20,6 +20,10 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Files</h1>
|
22
22
|
<div id="index-entries">
|
23
|
+
<a href="files/AUTHORS.html">AUTHORS</a><br />
|
24
|
+
<a href="files/ChangeLog.html">ChangeLog</a><br />
|
25
|
+
<a href="files/README.html">README</a><br />
|
26
|
+
<a href="files/USAGE.html">USAGE</a><br />
|
23
27
|
<a href="files/lib/xspf_rb.html">lib/xspf.rb</a><br />
|
24
28
|
<a href="files/xspf-expanded_rb.html">xspf-expanded.rb</a><br />
|
25
29
|
</div>
|
data/doc/fr_method_index.html
CHANGED
@@ -20,51 +20,95 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/XSPF/
|
24
|
-
<a href="classes/XSPF/
|
25
|
-
<a href="classes/XSPF/
|
26
|
-
<a href="classes/XSPF/
|
27
|
-
<a href="classes/XSPF/
|
28
|
-
<a href="classes/XSPF/
|
29
|
-
<a href="classes/XSPF/
|
30
|
-
<a href="classes/XSPF/
|
31
|
-
<a href="classes/XSPF.html#
|
32
|
-
<a href="classes/XSPF/
|
33
|
-
<a href="classes/XSPF/
|
34
|
-
<a href="classes/XSPF/
|
35
|
-
<a href="classes/XSPF/Playlist.html#
|
36
|
-
<a href="classes/XSPF/Track.html#
|
37
|
-
<a href="classes/XSPF/Playlist.html#
|
38
|
-
<a href="classes/XSPF/Playlist.html#
|
39
|
-
<a href="classes/XSPF/Track.html#
|
40
|
-
<a href="classes/XSPF/
|
41
|
-
<a href="classes/XSPF
|
42
|
-
<a href="classes/XSPF
|
43
|
-
<a href="classes/XSPF/
|
44
|
-
<a href="classes/XSPF/
|
45
|
-
<a href="classes/XSPF/Playlist.html#
|
46
|
-
<a href="classes/XSPF/Track.html#
|
47
|
-
<a href="classes/XSPF/
|
48
|
-
<a href="classes/XSPF/
|
49
|
-
<a href="classes/XSPF/
|
50
|
-
<a href="classes/XSPF/
|
51
|
-
<a href="classes/XSPF/Track.html#
|
52
|
-
<a href="classes/XSPF/
|
53
|
-
<a href="classes/XSPF/
|
54
|
-
<a href="classes/XSPF.html#
|
55
|
-
<a href="classes/XSPF.html#
|
56
|
-
<a href="classes/XSPF/
|
57
|
-
<a href="classes/XSPF/Playlist.html#
|
58
|
-
<a href="classes/XSPF.html#
|
59
|
-
<a href="classes/XSPF.html#
|
60
|
-
<a href="classes/XSPF.html#
|
61
|
-
<a href="classes/XSPF.html#
|
62
|
-
<a href="classes/XSPF/Playlist.html#
|
63
|
-
<a href="classes/XSPF/Track.html#
|
64
|
-
<a href="classes/XSPF/
|
65
|
-
<a href="classes/XSPF/
|
23
|
+
<a href="classes/XSPF/Playlist.html#M000083"><< (XSPF::Playlist)</a><br />
|
24
|
+
<a href="classes/XSPF/Tracklist.html#M000088"><< (XSPF::Tracklist)</a><br />
|
25
|
+
<a href="classes/XSPF/Track.html#M000028">album (XSPF::Track)</a><br />
|
26
|
+
<a href="classes/XSPF/Track.html#M000029">album= (XSPF::Track)</a><br />
|
27
|
+
<a href="classes/XSPF/Playlist.html#M000054">annotation (XSPF::Playlist)</a><br />
|
28
|
+
<a href="classes/XSPF/Track.html#M000022">annotation (XSPF::Track)</a><br />
|
29
|
+
<a href="classes/XSPF/Track.html#M000023">annotation= (XSPF::Track)</a><br />
|
30
|
+
<a href="classes/XSPF/Playlist.html#M000055">annotation= (XSPF::Playlist)</a><br />
|
31
|
+
<a href="classes/XSPF/Playlist.html#M000068">attribution (XSPF::Playlist)</a><br />
|
32
|
+
<a href="classes/XSPF/Playlist.html#M000069">attribution= (XSPF::Playlist)</a><br />
|
33
|
+
<a href="classes/XSPF/Track.html#M000020">creator (XSPF::Track)</a><br />
|
34
|
+
<a href="classes/XSPF/Playlist.html#M000052">creator (XSPF::Playlist)</a><br />
|
35
|
+
<a href="classes/XSPF/Playlist.html#M000053">creator= (XSPF::Playlist)</a><br />
|
36
|
+
<a href="classes/XSPF/Track.html#M000021">creator= (XSPF::Track)</a><br />
|
37
|
+
<a href="classes/XSPF/Playlist.html#M000064">date (XSPF::Playlist)</a><br />
|
38
|
+
<a href="classes/XSPF/Playlist.html#M000065">date= (XSPF::Playlist)</a><br />
|
39
|
+
<a href="classes/XSPF/Track.html#M000032">duration (XSPF::Track)</a><br />
|
40
|
+
<a href="classes/XSPF/Track.html#M000033">duration= (XSPF::Track)</a><br />
|
41
|
+
<a href="classes/XSPF.html#M000003">encoding (XSPF)</a><br />
|
42
|
+
<a href="classes/XSPF.html#M000004">encoding= (XSPF)</a><br />
|
43
|
+
<a href="classes/XSPF/Playlist.html#M000070">extension (XSPF::Playlist)</a><br />
|
44
|
+
<a href="classes/XSPF/Track.html#M000034">extension (XSPF::Track)</a><br />
|
45
|
+
<a href="classes/XSPF/Playlist.html#M000071">extension= (XSPF::Playlist)</a><br />
|
46
|
+
<a href="classes/XSPF/Track.html#M000035">extension= (XSPF::Track)</a><br />
|
47
|
+
<a href="classes/XSPF/Track.html#M000016">identifier (XSPF::Track)</a><br />
|
48
|
+
<a href="classes/XSPF/Playlist.html#M000060">identifier (XSPF::Playlist)</a><br />
|
49
|
+
<a href="classes/XSPF/Playlist.html#M000061">identifier= (XSPF::Playlist)</a><br />
|
50
|
+
<a href="classes/XSPF/Track.html#M000017">identifier= (XSPF::Track)</a><br />
|
51
|
+
<a href="classes/XSPF/Track.html#M000026">image (XSPF::Track)</a><br />
|
52
|
+
<a href="classes/XSPF/Playlist.html#M000062">image (XSPF::Playlist)</a><br />
|
53
|
+
<a href="classes/XSPF/Track.html#M000027">image= (XSPF::Track)</a><br />
|
54
|
+
<a href="classes/XSPF/Playlist.html#M000063">image= (XSPF::Playlist)</a><br />
|
55
|
+
<a href="classes/XSPF/Track.html#M000024">info (XSPF::Track)</a><br />
|
56
|
+
<a href="classes/XSPF/Playlist.html#M000056">info (XSPF::Playlist)</a><br />
|
57
|
+
<a href="classes/XSPF/Playlist.html#M000057">info= (XSPF::Playlist)</a><br />
|
58
|
+
<a href="classes/XSPF/Track.html#M000025">info= (XSPF::Track)</a><br />
|
59
|
+
<a href="classes/XSPF/Playlist.html#M000066">license (XSPF::Playlist)</a><br />
|
60
|
+
<a href="classes/XSPF/Playlist.html#M000067">license= (XSPF::Playlist)</a><br />
|
61
|
+
<a href="classes/XSPF/Track.html#M000036">link_content (XSPF::Track)</a><br />
|
62
|
+
<a href="classes/XSPF/Playlist.html#M000072">link_content (XSPF::Playlist)</a><br />
|
63
|
+
<a href="classes/XSPF/Track.html#M000037">link_content= (XSPF::Track)</a><br />
|
64
|
+
<a href="classes/XSPF/Playlist.html#M000073">link_content= (XSPF::Playlist)</a><br />
|
65
|
+
<a href="classes/XSPF/Track.html#M000038">link_rel (XSPF::Track)</a><br />
|
66
|
+
<a href="classes/XSPF/Playlist.html#M000074">link_rel (XSPF::Playlist)</a><br />
|
67
|
+
<a href="classes/XSPF/Playlist.html#M000075">link_rel= (XSPF::Playlist)</a><br />
|
68
|
+
<a href="classes/XSPF/Track.html#M000039">link_rel= (XSPF::Track)</a><br />
|
69
|
+
<a href="classes/XSPF/Track.html#M000014">location (XSPF::Track)</a><br />
|
70
|
+
<a href="classes/XSPF/Playlist.html#M000058">location (XSPF::Playlist)</a><br />
|
71
|
+
<a href="classes/XSPF/Playlist.html#M000059">location= (XSPF::Playlist)</a><br />
|
72
|
+
<a href="classes/XSPF/Track.html#M000015">location= (XSPF::Track)</a><br />
|
73
|
+
<a href="classes/XSPF/Playlist.html#M000076">meta_content (XSPF::Playlist)</a><br />
|
74
|
+
<a href="classes/XSPF/Track.html#M000040">meta_content (XSPF::Track)</a><br />
|
75
|
+
<a href="classes/XSPF/Track.html#M000041">meta_content= (XSPF::Track)</a><br />
|
76
|
+
<a href="classes/XSPF/Playlist.html#M000077">meta_content= (XSPF::Playlist)</a><br />
|
77
|
+
<a href="classes/XSPF/Track.html#M000042">meta_rel (XSPF::Track)</a><br />
|
78
|
+
<a href="classes/XSPF/Playlist.html#M000078">meta_rel (XSPF::Playlist)</a><br />
|
79
|
+
<a href="classes/XSPF/Playlist.html#M000079">meta_rel= (XSPF::Playlist)</a><br />
|
80
|
+
<a href="classes/XSPF/Track.html#M000043">meta_rel= (XSPF::Track)</a><br />
|
81
|
+
<a href="classes/XSPF/Track.html#M000044">new (XSPF::Track)</a><br />
|
82
|
+
<a href="classes/XSPF.html#M000009">new (XSPF)</a><br />
|
83
|
+
<a href="classes/XSPF/Tracklist.html#M000086">new (XSPF::Tracklist)</a><br />
|
84
|
+
<a href="classes/XSPF/Playlist.html#M000080">new (XSPF::Playlist)</a><br />
|
85
|
+
<a href="classes/XSPF.html#M000010">playlist (XSPF)</a><br />
|
86
|
+
<a href="classes/XSPF.html#M000011">playlist= (XSPF)</a><br />
|
87
|
+
<a href="classes/XSPF.html#M000013">playlist_xml (XSPF)</a><br />
|
88
|
+
<a href="classes/XSPF/Track.html#M000018">title (XSPF::Track)</a><br />
|
89
|
+
<a href="classes/XSPF/Playlist.html#M000050">title (XSPF::Playlist)</a><br />
|
90
|
+
<a href="classes/XSPF/Playlist.html#M000051">title= (XSPF::Playlist)</a><br />
|
91
|
+
<a href="classes/XSPF/Track.html#M000019">title= (XSPF::Track)</a><br />
|
92
|
+
<a href="classes/XSPF.html#M000006">to_html (XSPF)</a><br />
|
93
|
+
<a href="classes/XSPF.html#M000005">to_m3u (XSPF)</a><br />
|
94
|
+
<a href="classes/XSPF.html#M000007">to_smil (XSPF)</a><br />
|
95
|
+
<a href="classes/XSPF.html#M000008">to_soundblox (XSPF)</a><br />
|
96
|
+
<a href="classes/XSPF.html#M000012">to_xml (XSPF)</a><br />
|
97
|
+
<a href="classes/XSPF/Playlist.html#M000084">to_xml (XSPF::Playlist)</a><br />
|
98
|
+
<a href="classes/XSPF/Track.html#M000045">to_xml (XSPF::Track)</a><br />
|
99
|
+
<a href="classes/XSPF/Tracklist.html#M000089">to_xml (XSPF::Tracklist)</a><br />
|
100
|
+
<a href="classes/XSPF/Playlist.html#M000081">tracklist (XSPF::Playlist)</a><br />
|
101
|
+
<a href="classes/XSPF/Playlist.html#M000082">tracklist= (XSPF::Playlist)</a><br />
|
102
|
+
<a href="classes/XSPF/Playlist.html#M000085">tracklist_xml (XSPF::Playlist)</a><br />
|
103
|
+
<a href="classes/XSPF/Track.html#M000030">tracknum (XSPF::Track)</a><br />
|
104
|
+
<a href="classes/XSPF/Track.html#M000031">tracknum= (XSPF::Track)</a><br />
|
105
|
+
<a href="classes/XSPF/Tracklist.html#M000087">tracks (XSPF::Tracklist)</a><br />
|
106
|
+
<a href="classes/XSPF/Playlist.html#M000048">version (XSPF::Playlist)</a><br />
|
66
107
|
<a href="classes/XSPF.html#M000001">version (XSPF)</a><br />
|
67
|
-
<a href="classes/XSPF/Playlist.html#
|
108
|
+
<a href="classes/XSPF/Playlist.html#M000049">version= (XSPF::Playlist)</a><br />
|
109
|
+
<a href="classes/XSPF.html#M000002">version= (XSPF)</a><br />
|
110
|
+
<a href="classes/XSPF/Playlist.html#M000046">xmlns (XSPF::Playlist)</a><br />
|
111
|
+
<a href="classes/XSPF/Playlist.html#M000047">xmlns= (XSPF::Playlist)</a><br />
|
68
112
|
</div>
|
69
113
|
</div>
|
70
114
|
</body>
|
data/doc/index.html
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This is the right way to modify an existing XSPF document
|
2
|
+
|
3
|
+
require 'xspf'
|
4
|
+
|
5
|
+
f = File.new("playlist.xspf")
|
6
|
+
x = XSPF.new(f)
|
7
|
+
pl = x.playlist
|
8
|
+
tl = pl.tracklist
|
9
|
+
|
10
|
+
some_other_track = XSPF::Track.new( {
|
11
|
+
:location => 'http://some.nifty.locati.on/file1.ogg',
|
12
|
+
:identifier => 'http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83',
|
13
|
+
:title => 'Plus au sud',
|
14
|
+
:creator => 'Yann Tiersen',
|
15
|
+
:tracknum => '1',
|
16
|
+
:album => 'Tout est calme',
|
17
|
+
:meta_rel => 'http://www.example.org/key',
|
18
|
+
:meta_content => 'value'
|
19
|
+
} )
|
20
|
+
|
21
|
+
tl << some_other_track
|
22
|
+
pl.title = 'My modified playlist'
|
23
|
+
f = File.open('playlist.xspf', 'w')
|
24
|
+
f.write(x.to_xml)
|
25
|
+
f.close
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Although this does work, you'll want to use the code in parse_and_generate_right.rb
|
2
|
+
|
3
|
+
require 'xspf'
|
4
|
+
|
5
|
+
f = File.new("playlist.xspf")
|
6
|
+
x = XSPF.new(f)
|
7
|
+
pl = XSPF::Playlist.new(x)
|
8
|
+
tl = XSPF::Tracklist.new(pl)
|
9
|
+
|
10
|
+
some_other_track = XSPF::Track.new( {
|
11
|
+
:location => 'http://some.nifty.locati.on/file1.ogg',
|
12
|
+
:identifier => 'http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83',
|
13
|
+
:title => 'Plus au sud',
|
14
|
+
:creator => 'Yann Tiersen',
|
15
|
+
:tracknum => '1',
|
16
|
+
:album => 'Tout est calme',
|
17
|
+
:meta_rel => 'http://www.example.org/key',
|
18
|
+
:meta_content => 'value'
|
19
|
+
} )
|
20
|
+
|
21
|
+
tl << some_other_track
|
22
|
+
pl.title = 'My modified playlist'
|
23
|
+
pl.tracklist = tl
|
24
|
+
x.playlist = pl
|
25
|
+
f = File.open('playlist.xspf', 'w')
|
26
|
+
f.write(x.to_xml)
|
27
|
+
f.close
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This code does NOT work because 'pl' is a new object, unrelated to 'x'; and 'tl' is a new object, unrelated to 'pl'
|
2
|
+
|
3
|
+
require 'xspf'
|
4
|
+
|
5
|
+
f = File.new("playlist.xspf")
|
6
|
+
x = XSPF.new(f)
|
7
|
+
pl = XSPF::Playlist.new(x)
|
8
|
+
tl = XSPF::Tracklist.new(pl)
|
9
|
+
|
10
|
+
some_other_track = XSPF::Track.new( {
|
11
|
+
:location => 'http://some.nifty.locati.on/file1.ogg',
|
12
|
+
:identifier => 'http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83',
|
13
|
+
:title => 'Plus au sud',
|
14
|
+
:creator => 'Yann Tiersen',
|
15
|
+
:tracknum => '1',
|
16
|
+
:album => 'Tout est calme',
|
17
|
+
:meta_rel => 'http://www.example.org/key',
|
18
|
+
:meta_content => 'value'
|
19
|
+
} )
|
20
|
+
|
21
|
+
tl << some_other_track
|
22
|
+
pl.title = 'My modified playlist'
|
23
|
+
f = File.open('playlist.xspf', 'w')
|
24
|
+
f.write(x.to_xml)
|
25
|
+
f.close
|
@@ -1,15 +1,13 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
-
|
3
1
|
require 'xspf'
|
4
2
|
|
5
3
|
f = File.new("playlist.xspf")
|
6
|
-
|
7
4
|
x = XSPF.new(f)
|
5
|
+
f.close
|
6
|
+
pl = XSPF::Playlist.new(x)
|
7
|
+
tl = XSPF::Tracklist.new(pl)
|
8
|
+
|
8
9
|
puts "XML version: #{x.version}"
|
9
10
|
puts "XML encoding: #{ x.encoding}"
|
10
|
-
puts "-"*20
|
11
|
-
|
12
|
-
pl = XSPF::Playlist.new(x)
|
13
11
|
puts "XSPF version: #{pl.version}"
|
14
12
|
puts "Namespace: #{pl.xmlns}"
|
15
13
|
puts "Playlist title: #{pl.title}"
|
@@ -19,18 +17,19 @@ puts "Playlist info: #{pl.info}"
|
|
19
17
|
puts "Playlist identifier: #{pl.identifier}"
|
20
18
|
puts "Playlist attribution: #{pl.attribution}"
|
21
19
|
puts "Tracklist: #{pl.tracklist}"
|
22
|
-
puts "-"*20
|
23
|
-
|
24
|
-
tl = XSPF::Tracklist.new(pl)
|
25
20
|
tl.tracks.each do |t|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
puts "Track identifier: #{t.identifier}"
|
22
|
+
puts "Track title: #{t.title}"
|
23
|
+
puts "Track creator: #{t.creator}"
|
24
|
+
puts "Track duration: #{t.duration}"
|
25
|
+
puts "Track metainformation: link=#{t.meta_rel} content=#{t.meta_content}"
|
31
26
|
end
|
32
27
|
|
33
|
-
|
28
|
+
# Convert the XSPF document to SMIL
|
34
29
|
x.to_smil
|
30
|
+
|
31
|
+
# Convert the XSPF document to HTML
|
35
32
|
x.to_html
|
36
|
-
|
33
|
+
|
34
|
+
# Convert the XSPF document in a M3U playlist
|
35
|
+
x.to_m3u
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'xspf'
|
2
|
+
|
3
|
+
playlist_document = <<-END_OF_PLAYLIST
|
4
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
5
|
+
<playlist version="0" xmlns="http://xspf.org/ns/0/">
|
6
|
+
<title>XSPlF it up!</title>
|
7
|
+
<creator>Mayhem & Chaos Coordinator</creator>
|
8
|
+
<annotation>Just a few songs to enjoy while you XSPlF it up!</annotation>
|
9
|
+
<info>http://mayhem-chaos.net/xspf/xspf_it_up.html</info>
|
10
|
+
<identifier>http://mayhem-chaos.net/xspf/xspf_it_up/1.0</identifier>
|
11
|
+
<attribution>
|
12
|
+
<location>ihttp://mayhem-chaos.net/xspf/xspf_it_up.html</location>
|
13
|
+
</attribution>
|
14
|
+
<trackList>
|
15
|
+
<track>
|
16
|
+
<identifier>http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</identifier>
|
17
|
+
<title>I Wanna Get High</title>
|
18
|
+
<creator>Cypress Hill</creator>
|
19
|
+
<duration>174613</duration>
|
20
|
+
<meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</meta>
|
21
|
+
</track>
|
22
|
+
<track>
|
23
|
+
<identifier>bdc846e7-6c26-4193-82a6-8d1b5a4d3429</identifier>
|
24
|
+
<title>Smoke Two Joints</title>
|
25
|
+
<creator>Sublime</creator>
|
26
|
+
<duration>175466</duration>
|
27
|
+
<meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429</meta>
|
28
|
+
</track>
|
29
|
+
<track>
|
30
|
+
<identifier>http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</identifier>
|
31
|
+
<title>Hash Pipe</title>
|
32
|
+
<creator>Weezer</creator>
|
33
|
+
<duration>186533</duration>
|
34
|
+
<meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</meta>
|
35
|
+
</track>
|
36
|
+
</trackList>
|
37
|
+
</playlist>
|
38
|
+
END_OF_PLAYLIST
|
39
|
+
|
40
|
+
x = XSPF.new(playlist_document)
|
41
|
+
pl = XSPF::Playlist.new(x)
|
42
|
+
tl = XSPF::Tracklist.new(pl)
|
43
|
+
|
44
|
+
puts "XML version: #{x.version}"
|
45
|
+
puts "XML encoding: #{ x.encoding}"
|
46
|
+
puts "XSPF version: #{pl.version}"
|
47
|
+
puts "Namespace: #{pl.xmlns}"
|
48
|
+
puts "Playlist title: #{pl.title}"
|
49
|
+
puts "Playlist creator: #{pl.creator}"
|
50
|
+
puts "Playlist annotation: #{pl.annotation}"
|
51
|
+
puts "Playlist info: #{pl.info}"
|
52
|
+
puts "Playlist identifier: #{pl.identifier}"
|
53
|
+
puts "Playlist attribution: #{pl.attribution}"
|
54
|
+
puts "Tracklist: #{pl.tracklist}"
|
55
|
+
tl.tracks.each do |t|
|
56
|
+
puts "Track identifier: #{t.identifier}"
|
57
|
+
puts "Track title: #{t.title}"
|
58
|
+
puts "Track creator: #{t.creator}"
|
59
|
+
puts "Track duration: #{t.duration}"
|
60
|
+
puts "Track metainformation: link=#{t.meta_rel} content=#{t.meta_content}"
|
61
|
+
end
|
62
|
+
|
63
|
+
# Convert the XSPF document to SMIL
|
64
|
+
x.to_smil
|
65
|
+
|
66
|
+
# Convert the XSPF document to HTML
|
67
|
+
x.to_html
|
68
|
+
|
69
|
+
# Convert the XSPF document in a M3U playlist
|
70
|
+
x.to_m3u
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
+
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
|
3
|
+
<title>Tout est calme</title>
|
4
|
+
<creator>Yann Tiersen</creator>
|
5
|
+
<info>http://www.yanntiersen.com/</info>
|
6
|
+
<license>Redistribution or sharing not allowed</license>
|
7
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
8
|
+
<trackList>
|
9
|
+
<track>
|
10
|
+
<location>http://some.nifty.locati.on/file1.ogg</location>
|
11
|
+
<identifier>http://musicbrainz.org/track/9f342af1-982d-4c26-9f61-3ac258957a83</identifier>
|
12
|
+
<title>Plus au sud</title>
|
13
|
+
<creator>Yann Tiersen</creator>
|
14
|
+
<album>Tout est calme</album>
|
15
|
+
<trackNum>1</trackNum>
|
16
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
17
|
+
</track>
|
18
|
+
<track>
|
19
|
+
<location>http://some.nifty.locati.on/file2.ogg</location>
|
20
|
+
<identifier>http://musicbrainz.org/track/eba1a9a9-1810-41f1-8cc9-2a00dda0a68c</identifier>
|
21
|
+
<title>Les Grandes Marées</title>
|
22
|
+
<creator>Yann Tiersen</creator>
|
23
|
+
<album>Tout est calme</album>
|
24
|
+
<trackNum>2</trackNum>
|
25
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
26
|
+
</track>
|
27
|
+
<track>
|
28
|
+
<location>http://some.nifty.locati.on/file3.ogg</location>
|
29
|
+
<identifier>http://musicbrainz.org/track/0c18ef8c-04fa-47d5-b078-66ab6a819a83</identifier>
|
30
|
+
<title>La Crise</title>
|
31
|
+
<creator>Yann Tiersen</creator>
|
32
|
+
<album>Tout est calme</album>
|
33
|
+
<trackNum>3</trackNum>
|
34
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
35
|
+
</track>
|
36
|
+
<track>
|
37
|
+
<location>http://some.nifty.locati.on/file4.ogg</location>
|
38
|
+
<identifier>http://musicbrainz.org/track/0f66dd52-bda0-4526-979d-af95ac637cc4</identifier>
|
39
|
+
<title>Tout est calme</title>
|
40
|
+
<creator>Yann Tiersen</creator>
|
41
|
+
<album>Tout est calme</album>
|
42
|
+
<trackNum>4</trackNum>
|
43
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
44
|
+
</track>
|
45
|
+
<track>
|
46
|
+
<location>http://some.nifty.locati.on/file5.ogg</location>
|
47
|
+
<identifier>http://musicbrainz.org/track/a06ef58e-019e-409a-bf72-9bd080012ac3</identifier>
|
48
|
+
<title>La Rupture</title>
|
49
|
+
<creator>Yann Tiersen</creator>
|
50
|
+
<album>Tout est calme</album>
|
51
|
+
<trackNum>5</trackNum>
|
52
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
53
|
+
</track>
|
54
|
+
<track>
|
55
|
+
<location>http://some.nifty.locati.on/file6.ogg</location>
|
56
|
+
<identifier>http://musicbrainz.org/track/f82c0a06-d4a8-41a5-9238-029e38fa9d7c</identifier>
|
57
|
+
<title>La Relève</title>
|
58
|
+
<creator>Yann Tiersen</creator>
|
59
|
+
<album>Tout est calme</album>
|
60
|
+
<trackNum>6</trackNum>
|
61
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
62
|
+
</track>
|
63
|
+
<track>
|
64
|
+
<location>http://some.nifty.locati.on/file7.ogg</location>
|
65
|
+
<identifier>http://musicbrainz.org/track/97591e2b-967e-47eb-b2b3-9a450cd33352</identifier>
|
66
|
+
<title>La Pharmacie</title>
|
67
|
+
<creator>Yann Tiersen</creator>
|
68
|
+
<album>Tout est calme</album>
|
69
|
+
<trackNum>7</trackNum>
|
70
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
71
|
+
</track>
|
72
|
+
<track>
|
73
|
+
<location>http://some.nifty.locati.on/file8.ogg</location>
|
74
|
+
<identifier>http://musicbrainz.org/track/ae7f8502-778d-4f5e-9dba-6fc5d553ad0e</identifier>
|
75
|
+
<title>La Terrasse</title>
|
76
|
+
<creator>Yann Tiersen</creator>
|
77
|
+
<album>Tout est calme</album>
|
78
|
+
<trackNum>8</trackNum>
|
79
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
80
|
+
</track>
|
81
|
+
<track>
|
82
|
+
<location>http://some.nifty.locati.on/file9.ogg</location>
|
83
|
+
<identifier>http://musicbrainz.org/track/6e937503-9d01-428c-84b5-1200bab9d1c6</identifier>
|
84
|
+
<title>LÉtal</title>
|
85
|
+
<creator>Yann Tiersen</creator>
|
86
|
+
<album>Tout est calme</album>
|
87
|
+
<trackNum>9</trackNum>
|
88
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
89
|
+
</track>
|
90
|
+
<track>
|
91
|
+
<location>http://some.nifty.locati.on/file10.ogg</location>
|
92
|
+
<identifier>http://musicbrainz.org/track/2c4c845c-907a-4d96-940a-bbe8b2d0f126</identifier>
|
93
|
+
<title>La Découverte</title>
|
94
|
+
<creator>Yann Tiersen</creator>
|
95
|
+
<album>Tout est calme</album>
|
96
|
+
<trackNum>10</trackNum>
|
97
|
+
<meta rel='http://www.example.org/key'>value</meta>
|
98
|
+
</track>
|
99
|
+
</trackList>
|
100
|
+
</playlist>
|