xspf 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
3
3
  require 'xspf'
4
4
  require 'test/unit'
5
5
 
6
- class TestPlaylist < Test::Unit::TestCase
6
+ class TestParsePlaylist < Test::Unit::TestCase
7
7
 
8
8
  def setup
9
9
  @playlist_document = <<END_OF_PLAYLIST
@@ -88,3 +88,11 @@ END_OF_PLAYLIST
88
88
  end
89
89
 
90
90
  end
91
+
92
+ class TestError < Test::Unit::TestCase
93
+
94
+ def test_creation_error
95
+ assert_raise(TypeError) { XSPF::Playlist.new('error') }
96
+ end
97
+
98
+ end
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
3
3
  require 'xspf'
4
4
  require 'test/unit'
5
5
 
6
- class TestTrack < Test::Unit::TestCase
6
+ class TestParseTrack < Test::Unit::TestCase
7
7
 
8
8
  def setup
9
9
  @playlist_document = <<END_OF_PLAYLIST
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
3
3
  require 'xspf'
4
4
  require 'test/unit'
5
5
 
6
- class TestTracklist < Test::Unit::TestCase
6
+ class TestParseTracklist < Test::Unit::TestCase
7
7
 
8
8
  def setup
9
9
  @playlist_document = <<END_OF_PLAYLIST
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
3
3
  require 'xspf'
4
4
  require 'test/unit'
5
5
 
6
- class TestXSPF < Test::Unit::TestCase
6
+ class TestParseXSPF < Test::Unit::TestCase
7
7
 
8
8
  def setup
9
9
  @playlist_document = <<END_OF_PLAYLIST
@@ -51,14 +51,15 @@ END_OF_PLAYLIST
51
51
  end
52
52
 
53
53
  def test_version
54
- assert_equal(@xspf.version, "1.0")
54
+ assert_equal('1.0', @xspf.version)
55
55
  end
56
56
 
57
57
  def test_encoding
58
- assert_equal(@xspf.encoding, "UTF-8")
58
+ assert_equal('UTF-8', @xspf.encoding)
59
59
  end
60
60
 
61
61
  def test_error
62
62
  assert_raise(NoMethodError) {@xspf.inexistent_method }
63
63
  end
64
+
64
65
  end
@@ -1,9 +1,16 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), "..", "test")
2
2
 
3
3
  require 'test/unit'
4
- require 'tc_xspf'
5
- require 'tc_playlist'
6
- require 'tc_tracklist'
7
- require 'tc_track'
8
- require 'tc_output_formats'
4
+ require 'tc_parse_xspf'
5
+ require 'tc_parse_playlist'
6
+ require 'tc_parse_tracklist'
7
+ require 'tc_parse_track'
8
+ require 'tc_generate_xspf'
9
+ require 'tc_generate_playlist'
10
+ require 'tc_generate_tracklist'
11
+ require 'tc_generate_track'
12
+ require 'tc_dogfood'
13
+ require 'tc_parse_output_formats'
14
+ require 'tc_generate_output_formats'
15
+ require 'tc_rdoc'
9
16
 
@@ -1,152 +1,720 @@
1
1
  class XSPF
2
- # Version for the XML document or _nil_ if not defined
3
- def version; begin; @xspf.version; rescue NoMethodError; return nil; end; end
2
+ # Version for the XML document or _nil_ if not defined
3
+ def version
4
+ @version
5
+ end
6
+
7
+ def version=(value)
8
+ @version = value
9
+ end
10
+
11
+ private
12
+ def parse_version
13
+ begin
14
+ @xspf.version
15
+ rescue NoMethodError
16
+ return nil
17
+ end
18
+ end
19
+
4
20
  end
5
21
  class XSPF
6
- # Encoding of the XML document or _nil_ if not defined
7
- def encoding; begin; @xspf.encoding; rescue NoMethodError; return nil; end; end
22
+ # Encoding of the XML document or _nil_ if not defined
23
+ def encoding
24
+ @encoding
25
+ end
26
+
27
+ def encoding=(value)
28
+ @encoding = value
29
+ end
30
+
31
+ private
32
+ def parse_encoding
33
+ begin
34
+ @xspf.encoding
35
+ rescue NoMethodError
36
+ return nil
37
+ end
38
+ end
39
+
8
40
  end
9
41
  class XSPF
10
- # Creates a .m3u playlist from the XSPF document. This method makes use of the official XSPF to M3U XSLT transformation by Lucas Gonze.
11
- def to_m3u; xslt = XML::XSLT.new; xslt.xml = xspf; xslt.xsl = REXML::Document.new( File.new( './lib/xspf2m3u.xsl' ) ); xslt.serve; end
42
+ # Creates a .m3u playlist from the XSPF document. This method makes use of the official XSPF to M3U XSLT transformation by Lucas Gonze.
43
+ def to_m3u
44
+ xslt = XML::XSLT.new
45
+ xslt.xml = self.to_xml
46
+ xslt.xsl = REXML::Document.new( File.new( './lib/xspf2m3u.xsl' ) )
47
+ xslt.serve
48
+ end
49
+
12
50
  end
13
51
  class XSPF
14
- # Outputs the playlist as an HTML page. This method makes use of the official XSPF to HTML XSLT transformation by Lucas Gonze.
15
- def to_html; xslt = XML::XSLT.new; xslt.xml = xspf; xslt.xsl = REXML::Document.new( File.new( './lib/xspf2html.xsl' ) ); xslt.serve; end
52
+ # Outputs the playlist as an HTML page. This method makes use of the official XSPF to HTML XSLT transformation by Lucas Gonze.
53
+ def to_html
54
+ xslt = XML::XSLT.new
55
+ xslt.xml = self.to_xml
56
+ xslt.xsl = REXML::Document.new( File.new( './lib/xspf2html.xsl' ) )
57
+ xslt.serve
58
+ end
59
+
16
60
  end
17
61
  class XSPF
18
- # Creates a .smil playlist from the XSPF document. This method makes use of the official XSPF to SMIL XSLT transformation by Lucas Gonze.
19
- def to_smil; xslt = XML::XSLT.new; xslt.xml = xspf; xslt.xsl = REXML::Document.new( File.new( './lib/xspf2smil.xsl' ) ); xslt.serve; end
62
+ # Creates a .smil playlist from the XSPF document. This method makes use of the official XSPF to SMIL XSLT transformation by Lucas Gonze.
63
+ def to_smil
64
+ xslt = XML::XSLT.new
65
+ xslt.xml = self.to_xml
66
+ xslt.xsl = REXML::Document.new( File.new( './lib/xspf2smil.xsl' ) )
67
+ xslt.serve
68
+ end
69
+
20
70
  end
21
71
  class XSPF
22
- # Creates a SoundBlox playlist from the XSPF document. This method makes use of the official XSPF to SoundBlox XSLT tranformation by Lucas Gonze.
23
- def to_soundblox; xslt = XML::XSLT.new; xslt.xml = xspf; xslt.xsl = REXML::Document.new( File.new( './lib/xspf2soundblox.xsl' ) ); xslt.serve; end
72
+ # Creates a SoundBlox playlist from the XSPF document. This method makes use of the official XSPF to SoundBlox XSLT tranformation by Lucas Gonze.
73
+ def to_soundblox
74
+ xslt = XML::XSLT.new
75
+ xslt.xml = self.to_xml
76
+ xslt.xsl = REXML::Document.new( File.new( './lib/xspf2soundblox.xsl' ) )
77
+ xslt.serve
78
+ end
79
+
24
80
  end
25
81
  class XSPF::Playlist
26
- # The XML namespace. It must be http://xspf.org/ns/0/ for a valid XSPF document.
27
- def xmlns; begin; @playlist.root.attributes['xmlns']; rescue NoMethodError; return nil; end; end
82
+ # The XML namespace. It must be http://xspf.org/ns/0/ for a valid XSPF document.
83
+ def xmlns
84
+ @xmlns
85
+ end
86
+
87
+ def xmlns=(value)
88
+ @xmlns = value
89
+ end
90
+
91
+ private
92
+ def parse_xmlns
93
+ begin
94
+ @playlist.root.attributes['xmlns']
95
+ rescue NoMethodError
96
+ return nil
97
+ end
98
+ end
99
+
28
100
  end
29
101
  class XSPF::Playlist
30
- # The XSPF version. It may be 0 or 1, although 1 is strongly advised.
31
- def version; begin; @playlist.root.attributes['version']; rescue NoMethodError; return nil; end; end
102
+ # The XSPF version. It may be 0 or 1, although 1 is strongly advised.
103
+ def version
104
+ @version
105
+ end
106
+
107
+ def version=(value)
108
+ @version = value
109
+ end
110
+
111
+ private
112
+ def parse_version
113
+ begin
114
+ @playlist.root.attributes['version']
115
+ rescue NoMethodError
116
+ return nil
117
+ end
118
+ end
119
+
32
120
  end
33
121
  class XSPF::Playlist
34
- # A human-readable title for the playlist. xspf:playlist elements MAY contain exactly one.
35
- def title; begin; @playlist.elements['title'].text; rescue NoMethodError; return nil; end; end
122
+ # A human-readable title for the playlist. xspf:playlist elements MAY contain exactly one.
123
+ def title
124
+ @title
125
+ end
126
+
127
+ def title=(value)
128
+ @title = value
129
+ end
130
+
131
+ private
132
+ def parse_title
133
+ begin
134
+ @playlist.elements['title'].text
135
+ rescue NoMethodError
136
+ return nil
137
+ end
138
+ end
139
+
36
140
  end
37
141
  class XSPF::Playlist
38
- # Human-readable name of the entity (author, authors, group, company, etc) that authored the playlist. XSPF::Playlist objects MAY contain exactly one.
39
- def creator; begin; @playlist.elements['creator'].text; rescue NoMethodError; return nil; end; end
142
+ # Human-readable name of the entity (author, authors, group, company, etc) that authored the playlist. XSPF::Playlist objects MAY contain exactly one.
143
+ def creator
144
+ @creator
145
+ end
146
+
147
+ def creator=(value)
148
+ @creator = value
149
+ end
150
+
151
+ private
152
+ def parse_creator
153
+ begin
154
+ @playlist.elements['creator'].text
155
+ rescue NoMethodError
156
+ return nil
157
+ end
158
+ end
159
+
40
160
  end
41
161
  class XSPF::Playlist
42
- # A human-readable comment on the playlist. This is character data, not HTML, and it may not contain markup. XSPF::Playlist objects elements MAY contain exactly one.
43
- def annotation; begin; @playlist.elements['annotation'].text; rescue NoMethodError; return nil; end; end
162
+ # A human-readable comment on the playlist. This is character data, not HTML, and it may not contain markup. XSPF::Playlist objects elements MAY contain exactly one.
163
+ def annotation
164
+ @annotation
165
+ end
166
+
167
+ def annotation=(value)
168
+ @annotation = value
169
+ end
170
+
171
+ private
172
+ def parse_annotation
173
+ begin
174
+ @playlist.elements['annotation'].text
175
+ rescue NoMethodError
176
+ return nil
177
+ end
178
+ end
179
+
44
180
  end
45
181
  class XSPF::Playlist
46
- # URL of a web page to find out more about this playlist. Likely to be homepage of the author, and would be used to find out more about the author and to find more playlists by the author. XSPF::Playlist objects MAY contain exactly one.
47
- def info; begin; @playlist.elements['info'].text; rescue NoMethodError; return nil; end; end
182
+ # URL of a web page to find out more about this playlist. Likely to be homepage of the author, and would be used to find out more about the author and to find more playlists by the author. XSPF::Playlist objects MAY contain exactly one.
183
+ def info
184
+ @info
185
+ end
186
+
187
+ def info=(value)
188
+ @info = value
189
+ end
190
+
191
+ private
192
+ def parse_info
193
+ begin
194
+ @playlist.elements['info'].text
195
+ rescue NoMethodError
196
+ return nil
197
+ end
198
+ end
199
+
48
200
  end
49
201
  class XSPF::Playlist
50
- # Source URL for this playlist. XSPF::Playlist objects MAY contain exactly one.
51
- def location; begin; @playlist.elements['location'].text; rescue NoMethodError; return nil; end; end
202
+ # Source URL for this playlist. XSPF::Playlist objects MAY contain exactly one.
203
+ def location
204
+ @location
205
+ end
206
+
207
+ def location=(value)
208
+ @location = value
209
+ end
210
+
211
+ private
212
+ def parse_location
213
+ begin
214
+ @playlist.elements['location'].text
215
+ rescue NoMethodError
216
+ return nil
217
+ end
218
+ end
219
+
52
220
  end
53
221
  class XSPF::Playlist
54
- # Canonical ID for this playlist. Likely to be a hash or other location-independent name. MUST be a legal URN. XSPF::Playlist objects MAY contain exactly one.
55
- def identifier; begin; @playlist.elements['identifier'].text; rescue NoMethodError; return nil; end; end
222
+ # Canonical ID for this playlist. Likely to be a hash or other location-independent name. MUST be a legal URN. XSPF::Playlist objects MAY contain exactly one.
223
+ def identifier
224
+ @identifier
225
+ end
226
+
227
+ def identifier=(value)
228
+ @identifier = value
229
+ end
230
+
231
+ private
232
+ def parse_identifier
233
+ begin
234
+ @playlist.elements['identifier'].text
235
+ rescue NoMethodError
236
+ return nil
237
+ end
238
+ end
239
+
56
240
  end
57
241
  class XSPF::Playlist
58
- # URL of an image to display if XSPF::Playlist#image return nil. XSPF::Playlist objects MAY contain exactly one.
59
- def image; begin; @playlist.elements['image'].text; rescue NoMethodError; return nil; end; end
242
+ # URL of an image to display if XSPF::Playlist#image return nil. XSPF::Playlist objects MAY contain exactly one.
243
+ def image
244
+ @image
245
+ end
246
+
247
+ def image=(value)
248
+ @image = value
249
+ end
250
+
251
+ private
252
+ def parse_image
253
+ begin
254
+ @playlist.elements['image'].text
255
+ rescue NoMethodError
256
+ return nil
257
+ end
258
+ end
259
+
60
260
  end
61
261
  class XSPF::Playlist
62
- # Creation date (not last-modified date) of the playlist, formatted as a XML schema dateTime. XSPF::Playlist objects MAY contain exactly one.
63
- def date; begin; @playlist.elements['date'].text; rescue NoMethodError; return nil; end; end
262
+ # Creation date (not last-modified date) of the playlist, formatted as a XML schema dateTime. XSPF::Playlist objects MAY contain exactly one.
263
+ def date
264
+ @date
265
+ end
266
+
267
+ def date=(value)
268
+ @date = value
269
+ end
270
+
271
+ private
272
+ def parse_date
273
+ begin
274
+ @playlist.elements['date'].text
275
+ rescue NoMethodError
276
+ return nil
277
+ end
278
+ end
279
+
64
280
  end
65
281
  class XSPF::Playlist
66
- # URL of a resource that describes the license under which this playlist was released. XSPF::Playlist objects MAY contain zero or one license element.
67
- def license; begin; @playlist.elements['license'].text; rescue NoMethodError; return nil; end; end
282
+ # URL of a resource that describes the license under which this playlist was released. XSPF::Playlist objects MAY contain zero or one license element.
283
+ def license
284
+ @license
285
+ end
286
+
287
+ def license=(value)
288
+ @license = value
289
+ end
290
+
291
+ private
292
+ def parse_license
293
+ begin
294
+ @playlist.elements['license'].text
295
+ rescue NoMethodError
296
+ return nil
297
+ end
298
+ end
299
+
68
300
  end
69
301
  class XSPF::Playlist
70
- # An ordered list of URIs. The purpose is to satisfy licenses allowing modification but requiring attribution. If you modify such a playlist, move its XSPF::Playlist#location or XSPF::Playlist#identifier element to the top of the items in the XSPF::Playlist#attribution element. XSPF::Playlist objects MAY contain exactly one attribution element. Please note that currently XSPF for Ruby does not parse the contents of XSPF::Playlist#attribution.
71
- def attribution; begin; @playlist.elements['attribution'].text; rescue NoMethodError; return nil; end; end
302
+ # An ordered list of URIs. The purpose is to satisfy licenses allowing modification but requiring attribution. If you modify such a playlist, move its XSPF::Playlist#location or XSPF::Playlist#identifier element to the top of the items in the XSPF::Playlist#attribution element. XSPF::Playlist objects MAY contain exactly one attribution element. Please note that currently XSPF for Ruby does not parse the contents of XSPF::Playlist#attribution.
303
+ def attribution
304
+ @attribution
305
+ end
306
+
307
+ def attribution=(value)
308
+ @attribution = value
309
+ end
310
+
311
+ private
312
+ def parse_attribution
313
+ begin
314
+ @playlist.elements['attribution'].text
315
+ rescue NoMethodError
316
+ return nil
317
+ end
318
+ end
319
+
72
320
  end
73
321
  class XSPF::Playlist
74
- # The extension element allows non-XSPF XML to be included in XSPF documents without breaking XSPF validation. The purpose is to allow nested XML, which the meta and link elements do not. XSPF::Playlist objects MAY contain zero or more extension elements but currently XSPF for Ruby returns only the first one.
75
- def extension; begin; @playlist.elements['extension'].text; rescue NoMethodError; return nil; end; end
322
+ # The extension element allows non-XSPF XML to be included in XSPF documents without breaking XSPF validation. The purpose is to allow nested XML, which the meta and link elements do not. XSPF::Playlist objects MAY contain zero or more extension elements but currently XSPF for Ruby returns only the first one.
323
+ def extension
324
+ @extension
325
+ end
326
+
327
+ def extension=(value)
328
+ @extension = value
329
+ end
330
+
331
+ private
332
+ def parse_extension
333
+ begin
334
+ @playlist.elements['extension'].text
335
+ rescue NoMethodError
336
+ return nil
337
+ end
338
+ end
339
+
76
340
  end
77
341
  class XSPF::Playlist
78
- # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid 'link' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Playlist#link_rel and XSPF::Playlist#link_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
79
- def link_content; begin; @playlist.elements['link'].text; rescue NoMethodError; return nil; end; end
342
+ # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid _link_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Playlist#link_rel and XSPF::Playlist#link_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
343
+ def link_content
344
+ @link_content
345
+ end
346
+
347
+ def link_content=(value)
348
+ @link_content = value
349
+ end
350
+
351
+ private
352
+ def parse_link_content
353
+ begin
354
+ @playlist.elements['link'].text
355
+ rescue NoMethodError
356
+ return nil
357
+ end
358
+ end
359
+
80
360
  end
81
361
  class XSPF::Playlist
82
- # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid 'link' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Playlist#link_rel and XSPF::Playlist#link_content respectively. XSPF::Playlist objects MAY contain zero or more link elements, but currently XSPF for Ruby returns only the first one.
83
- def link_rel; begin; @playlist.elements['link'].attributes['rel']; rescue NoMethodError; return nil; end; end
362
+ # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid _link_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Playlist#link_rel and XSPF::Playlist#link_content respectively. XSPF::Playlist objects MAY contain zero or more link elements, but currently XSPF for Ruby returns only the first one.
363
+ def link_rel
364
+ @link_rel
365
+ end
366
+
367
+ def link_rel=(value)
368
+ @link_rel = value
369
+ end
370
+
371
+ private
372
+ def parse_link_rel
373
+ begin
374
+ @playlist.elements['link'].attributes['rel']
375
+ rescue NoMethodError
376
+ return nil
377
+ end
378
+ end
379
+
84
380
  end
85
381
  class XSPF::Playlist
86
- # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid 'meta' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Playlist#meta_rel and XSPF::Playlist#meta_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
87
- def meta_content; begin; @playlist.elements['meta'].text; rescue NoMethodError; return nil; end; end
382
+ # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid _meta_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Playlist#meta_rel and XSPF::Playlist#meta_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
383
+ def meta_content
384
+ @meta_content
385
+ end
386
+
387
+ def meta_content=(value)
388
+ @meta_content = value
389
+ end
390
+
391
+ private
392
+ def parse_meta_content
393
+ begin
394
+ @playlist.elements['meta'].text
395
+ rescue NoMethodError
396
+ return nil
397
+ end
398
+ end
399
+
88
400
  end
89
401
  class XSPF::Playlist
90
- # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid 'meta' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Playlist#meta_rel and XSPF::Playlist#meta_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
91
- def meta_rel; begin; @playlist.elements['meta'].attributes['rel']; rescue NoMethodError; return nil; end; end
402
+ # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid _meta_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Playlist#meta_rel and XSPF::Playlist#meta_content respectively. XSPF::Playlist objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
403
+ def meta_rel
404
+ @meta_rel
405
+ end
406
+
407
+ def meta_rel=(value)
408
+ @meta_rel = value
409
+ end
410
+
411
+ private
412
+ def parse_meta_rel
413
+ begin
414
+ @playlist.elements['meta'].attributes['rel']
415
+ rescue NoMethodError
416
+ return nil
417
+ end
418
+ end
419
+
92
420
  end
93
421
  class XSPF::Track
94
- # URL of resource to be rendered. Probably an audio resource, but MAY be any type of resource with a well-known duration, such as video, a SMIL document, or an XSPF document. The duration of the resource defined in this element defines the duration of rendering. XSPF::Track objects MAY contain zero or more location elements, but a user-agent MUST NOT render more than one of the named resources. Currently, XSPF for Ruby returns only the first location.
95
- def location; begin; @track.elements['location'].text; rescue NoMethodError; return nil; end; end
422
+ # URL of resource to be rendered. Probably an audio resource, but MAY be any type of resource with a well-known duration, such as video, a SMIL document, or an XSPF document. The duration of the resource defined in this element defines the duration of rendering. XSPF::Track objects MAY contain zero or more location elements, but a user-agent MUST NOT render more than one of the named resources. Currently, XSPF for Ruby returns only the first location.
423
+ def location
424
+ @location
425
+ end
426
+
427
+ def location=(value)
428
+ @location = value
429
+ end
430
+
431
+ private
432
+ def parse_location
433
+ begin
434
+ @track.elements['location'].text
435
+ rescue NoMethodError
436
+ return nil
437
+ end
438
+ end
439
+
96
440
  end
97
441
  class XSPF::Track
98
- # Canonical ID for this resource. Likely to be a hash or other location-independent name, such as a MusicBrainz identifier or isbn URN (if there existed isbn numbers for audio). MUST be a legal URN. XSPF::Track objects elements MAY contain zero or more identifier elements, but currently XSPF for Ruby returns only the first one.
99
- def identifier; begin; @track.elements['identifier'].text; rescue NoMethodError; return nil; end; end
442
+ # Canonical ID for this resource. Likely to be a hash or other location-independent name, such as a MusicBrainz identifier or isbn URN (if there existed isbn numbers for audio). MUST be a legal URN. XSPF::Track objects elements MAY contain zero or more identifier elements, but currently XSPF for Ruby returns only the first one.
443
+ def identifier
444
+ @identifier
445
+ end
446
+
447
+ def identifier=(value)
448
+ @identifier = value
449
+ end
450
+
451
+ private
452
+ def parse_identifier
453
+ begin
454
+ @track.elements['identifier'].text
455
+ rescue NoMethodError
456
+ return nil
457
+ end
458
+ end
459
+
100
460
  end
101
461
  class XSPF::Track
102
- # Human-readable name of the track that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
103
- def title; begin; @track.elements['title'].text; rescue NoMethodError; return nil; end; end
462
+ # Human-readable name of the track that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
463
+ def title
464
+ @title
465
+ end
466
+
467
+ def title=(value)
468
+ @title = value
469
+ end
470
+
471
+ private
472
+ def parse_title
473
+ begin
474
+ @track.elements['title'].text
475
+ rescue NoMethodError
476
+ return nil
477
+ end
478
+ end
479
+
104
480
  end
105
481
  class XSPF::Track
106
- # Human-readable name of the entity (author, authors, group, company, etc) that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
107
- def creator; begin; @track.elements['creator'].text; rescue NoMethodError; return nil; end; end
482
+ # Human-readable name of the entity (author, authors, group, company, etc) that authored the resource which defines the duration of track rendering. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
483
+ def creator
484
+ @creator
485
+ end
486
+
487
+ def creator=(value)
488
+ @creator = value
489
+ end
490
+
491
+ private
492
+ def parse_creator
493
+ begin
494
+ @track.elements['creator'].text
495
+ rescue NoMethodError
496
+ return nil
497
+ end
498
+ end
499
+
108
500
  end
109
501
  class XSPF::Track
110
- # A human-readable comment on the track. This is character data, not HTML, and it may not contain markup. XSPF::Track objects MAY contain exactly one.
111
- def annotation; begin; @track.elements['annotation'].text; rescue NoMethodError; return nil; end; end
502
+ # A human-readable comment on the track. This is character data, not HTML, and it may not contain markup. XSPF::Track objects MAY contain exactly one.
503
+ def annotation
504
+ @annotation
505
+ end
506
+
507
+ def annotation=(value)
508
+ @annotation = value
509
+ end
510
+
511
+ private
512
+ def parse_annotation
513
+ begin
514
+ @track.elements['annotation'].text
515
+ rescue NoMethodError
516
+ return nil
517
+ end
518
+ end
519
+
112
520
  end
113
521
  class XSPF::Track
114
- # URL of a place where this resource can be bought or more info can be found.
115
- def info; begin; @track.elements['info'].text; rescue NoMethodError; return nil; end; end
522
+ # URL of a place where this resource can be bought or more info can be found.
523
+ def info
524
+ @info
525
+ end
526
+
527
+ def info=(value)
528
+ @info = value
529
+ end
530
+
531
+ private
532
+ def parse_info
533
+ begin
534
+ @track.elements['info'].text
535
+ rescue NoMethodError
536
+ return nil
537
+ end
538
+ end
539
+
116
540
  end
117
541
  class XSPF::Track
118
- # URL of an image to display for the duration of the track. XSPF::Track objects MAY contain exactly one.
119
- def image; begin; @track.elements['image'].text; rescue NoMethodError; return nil; end; end
542
+ # URL of an image to display for the duration of the track. XSPF::Track objects MAY contain exactly one.
543
+ def image
544
+ @image
545
+ end
546
+
547
+ def image=(value)
548
+ @image = value
549
+ end
550
+
551
+ private
552
+ def parse_image
553
+ begin
554
+ @track.elements['image'].text
555
+ rescue NoMethodError
556
+ return nil
557
+ end
558
+ end
559
+
120
560
  end
121
561
  class XSPF::Track
122
- # Human-readable name of the collection from which the resource which defines the duration of track rendering comes. For a song originally published as a part of a CD or LP, this would be the title of the original release. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
123
- def album; begin; @track.elements['album'].text; rescue NoMethodError; return nil; end; end
562
+ # Human-readable name of the collection from which the resource which defines the duration of track rendering comes. For a song originally published as a part of a CD or LP, this would be the title of the original release. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one.
563
+ def album
564
+ @album
565
+ end
566
+
567
+ def album=(value)
568
+ @album = value
569
+ end
570
+
571
+ private
572
+ def parse_album
573
+ begin
574
+ @track.elements['album'].text
575
+ rescue NoMethodError
576
+ return nil
577
+ end
578
+ end
579
+
124
580
  end
125
581
  class XSPF::Track
126
- # Integer with value greater than zero giving the ordinal position of the media on the XSPF::Track#album. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one. It MUST be a valid XML Schema nonNegativeInteger.
127
- def tracknum; begin; @track.elements['trackNum'].text; rescue NoMethodError; return nil; end; end
582
+ # Integer with value greater than zero giving the ordinal position of the media on the XSPF::Track#album. This value is primarily for fuzzy lookups, though a user-agent may display it. XSPF::Track objects MAY contain exactly one. It MUST be a valid XML Schema nonNegativeInteger.
583
+ def tracknum
584
+ @trackNum
585
+ end
586
+
587
+ def tracknum=(value)
588
+ @tracknum = value
589
+ end
590
+
591
+ private
592
+ def parse_tracknum
593
+ begin
594
+ @track.elements['trackNum'].text
595
+ rescue NoMethodError
596
+ return nil
597
+ end
598
+ end
599
+
128
600
  end
129
601
  class XSPF::Track
130
- # The time to render a resource, in milliseconds. It MUST be a valid XML Schema nonNegativeInteger. This value is only a hint -- different XSPF generators will generate slightly different values. A user-agent MUST NOT use this value to determine the rendering duration, since the data will likely be low quality. XSPF::Track objects MAY contain exactly one duration element.
131
- def duration; begin; @track.elements['duration'].text; rescue NoMethodError; return nil; end; end
602
+ # The time to render a resource, in milliseconds. It MUST be a valid XML Schema nonNegativeInteger. This value is only a hint -- different XSPF generators will generate slightly different values. A user-agent MUST NOT use this value to determine the rendering duration, since the data will likely be low quality. XSPF::Track objects MAY contain exactly one duration element.
603
+ def duration
604
+ @duration
605
+ end
606
+
607
+ def duration=(value)
608
+ @duration = value
609
+ end
610
+
611
+ private
612
+ def parse_duration
613
+ begin
614
+ @track.elements['duration'].text
615
+ rescue NoMethodError
616
+ return nil
617
+ end
618
+ end
619
+
132
620
  end
133
621
  class XSPF::Track
134
- # The extension element allows non-XSPF XML to be included in XSPF documents without breaking XSPF validation. The purpose is to allow nested XML, which the meta and link elements do not. XSPF::Track objects MAY contain zero or more extension elements, but currently XSPF for Ruby returns only the first one.
135
- def extension; begin; @track.elements['extension'].text; rescue NoMethodError; return nil; end; end
622
+ # The extension element allows non-XSPF XML to be included in XSPF documents without breaking XSPF validation. The purpose is to allow nested XML, which the meta and link elements do not. XSPF::Track objects MAY contain zero or more extension elements, but currently XSPF for Ruby returns only the first one.
623
+ def extension
624
+ @extension
625
+ end
626
+
627
+ def extension=(value)
628
+ @extension = value
629
+ end
630
+
631
+ private
632
+ def parse_extension
633
+ begin
634
+ @track.elements['extension'].text
635
+ rescue NoMethodError
636
+ return nil
637
+ end
638
+ end
639
+
136
640
  end
137
641
  class XSPF::Track
138
- # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid 'link' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Track#link_rel and XSPF::Track#link_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
139
- def link_content; begin; @track.elements['link'].text; rescue NoMethodError; return nil; end; end
642
+ # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid _link_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Track#link_rel and XSPF::Track#link_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
643
+ def link_content
644
+ @link_content
645
+ end
646
+
647
+ def link_content=(value)
648
+ @link_content = value
649
+ end
650
+
651
+ private
652
+ def parse_link_content
653
+ begin
654
+ @track.elements['link'].text
655
+ rescue NoMethodError
656
+ return nil
657
+ end
658
+ end
659
+
140
660
  end
141
661
  class XSPF::Track
142
- # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid 'link' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Track#link_rel and XSPF::Track#link_content respectively. XSPF::Track objects MAY contain zero or more link elements, but currently XSPF for Ruby returns only the first one.
143
- def link_rel; begin; @track.elements['link'].attributes['rel']; rescue NoMethodError; return nil; end; end
662
+ # The link element allows non-XSPF web resources to be included in XSPF documents without breaking XSPF validation. A valid _link_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Track#link_rel and XSPF::Track#link_content respectively. XSPF::Track objects MAY contain zero or more link elements, but currently XSPF for Ruby returns only the first one.
663
+ def link_rel
664
+ @link_rel
665
+ end
666
+
667
+ def link_rel=(value)
668
+ @link_rel = value
669
+ end
670
+
671
+ private
672
+ def parse_link_rel
673
+ begin
674
+ @track.elements['link'].attributes['rel']
675
+ rescue NoMethodError
676
+ return nil
677
+ end
678
+ end
679
+
144
680
  end
145
681
  class XSPF::Track
146
- # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid 'meta' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Track#meta_rel and XSPF::Track#meta_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
147
- def meta_content; begin; @track.elements['meta'].text; rescue NoMethodError; return nil; end; end
682
+ # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid _meta_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Track#meta_rel and XSPF::Track#meta_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
683
+ def meta_content
684
+ @meta_content
685
+ end
686
+
687
+ def meta_content=(value)
688
+ @meta_content = value
689
+ end
690
+
691
+ private
692
+ def parse_meta_content
693
+ begin
694
+ @track.elements['meta'].text
695
+ rescue NoMethodError
696
+ return nil
697
+ end
698
+ end
699
+
148
700
  end
149
701
  class XSPF::Track
150
- # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid 'meta' element has a 'rel' attribute and a 'content' element, obtained with XSPF::Track#meta_rel and XSPF::Track#meta_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
151
- def meta_rel; begin; @track.elements['meta'].attributes['rel']; rescue NoMethodError; return nil; end; end
702
+ # The meta element allows non-XSPF metadata to be included in XSPF documents without breaking XSPF validation. A valid _meta_ element has a _rel_ attribute and a _content_ element, obtained with XSPF::Track#meta_rel and XSPF::Track#meta_content respectively. XSPF::Track objects MAY contain zero or more meta elements, but currently XSPF for Ruby returns only the first one.
703
+ def meta_rel
704
+ @meta_rel
705
+ end
706
+
707
+ def meta_rel=(value)
708
+ @meta_rel = value
709
+ end
710
+
711
+ private
712
+ def parse_meta_rel
713
+ begin
714
+ @track.elements['meta'].attributes['rel']
715
+ rescue NoMethodError
716
+ return nil
717
+ end
718
+ end
719
+
152
720
  end