xspf 0.3

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.
@@ -0,0 +1,90 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'xspf'
4
+ require 'test/unit'
5
+
6
+ class TestPlaylist < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @playlist_document = <<END_OF_PLAYLIST
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <playlist version="0" xmlns="http://xspf.org/ns/0/">
12
+ <title>XSPlF it up!</title>
13
+ <creator>Mayhem &amp; Chaos Coordinator</creator>
14
+ <annotation>Just a few songs to enjoy while you XSPlF it up!</annotation>
15
+ <info>http://mayhem-chaos.net/xspf/xspf_it_up.html</info>
16
+ <identifier>http://mayhem-chaos.net/xspf/xspf_it_up/1.0</identifier>
17
+ <attribution>
18
+ <location>ihttp://mayhem-chaos.net/xspf/xspf_it_up.html</location>
19
+ </attribution>
20
+ <trackList>
21
+ <track>
22
+ <identifier>http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</identifier>
23
+ <title>I Wanna Get High</title>
24
+ <creator>Cypress Hill</creator>
25
+ <duration>174613</duration>
26
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</meta>
27
+ </track>
28
+ <track>
29
+ <identifier>bdc846e7-6c26-4193-82a6-8d1b5a4d3429</identifier>
30
+ <title>Smoke Two Joints</title>
31
+ <creator>Sublime</creator>
32
+ <duration>175466</duration>
33
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429</meta>
34
+ </track>
35
+ <track>
36
+ <identifier>http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</identifier>
37
+ <title>Hash Pipe</title>
38
+ <creator>Weezer</creator>
39
+ <duration>186533</duration>
40
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</meta>
41
+ </track>
42
+ </trackList>
43
+ </playlist>
44
+ END_OF_PLAYLIST
45
+
46
+ xspf = XSPF.new(@playlist_document)
47
+ @playlist = XSPF::Playlist.new(xspf)
48
+ end
49
+
50
+ def test_class
51
+ assert_instance_of(XSPF::Playlist, @playlist)
52
+ end
53
+
54
+ def test_version
55
+ assert_equal(@playlist.version, "0")
56
+ end
57
+
58
+ def test_xmlns
59
+ assert_equal(@playlist.xmlns, "http://xspf.org/ns/0/")
60
+ end
61
+
62
+ def test_title
63
+ assert_equal(@playlist.title, "XSPlF it up!")
64
+ end
65
+
66
+ def test_creator
67
+ assert_equal(@playlist.creator, "Mayhem & Chaos Coordinator")
68
+ end
69
+
70
+ def test_annotation
71
+ assert_equal(@playlist.annotation, "Just a few songs to enjoy while you XSPlF it up!")
72
+ end
73
+
74
+ def test_info
75
+ assert_equal(@playlist.info, "http://mayhem-chaos.net/xspf/xspf_it_up.html")
76
+ end
77
+
78
+ def test_identifier
79
+ assert_equal(@playlist.identifier, "http://mayhem-chaos.net/xspf/xspf_it_up/1.0")
80
+ end
81
+
82
+ def test_nil
83
+ assert_nil(@playlist.image)
84
+ end
85
+
86
+ def test_error
87
+ assert_raise(NoMethodError) { @playlist.inexistent_method }
88
+ end
89
+
90
+ end
data/test/tc_track.rb ADDED
@@ -0,0 +1,85 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'xspf'
4
+ require 'test/unit'
5
+
6
+ class TestTrack < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @playlist_document = <<END_OF_PLAYLIST
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <playlist version="0" xmlns="http://xspf.org/ns/0/">
12
+ <title>XSPlF it up!</title>
13
+ <creator>Mayhem &amp; Chaos Coordinator</creator>
14
+ <annotation>Just a few songs to enjoy while you XSPlF it up!</annotation>
15
+ <info>http://mayhem-chaos.net/xspf/xspf_it_up.html</info>
16
+ <identifier>http://mayhem-chaos.net/xspf/xspf_it_up/1.0</identifier>
17
+ <attribution>
18
+ <location>ihttp://mayhem-chaos.net/xspf/xspf_it_up.html</location>
19
+ </attribution>
20
+ <trackList>
21
+ <track>
22
+ <identifier>http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</identifier>
23
+ <title>I Wanna Get High</title>
24
+ <creator>Cypress Hill</creator>
25
+ <duration>174613</duration>
26
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</meta>
27
+ </track>
28
+ <track>
29
+ <identifier>bdc846e7-6c26-4193-82a6-8d1b5a4d3429</identifier>
30
+ <title>Smoke Two Joints</title>
31
+ <creator>Sublime</creator>
32
+ <duration>175466</duration>
33
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429</meta>
34
+ </track>
35
+ <track>
36
+ <identifier>http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</identifier>
37
+ <title>Hash Pipe</title>
38
+ <creator>Weezer</creator>
39
+ <duration>186533</duration>
40
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</meta>
41
+ </track>
42
+ </trackList>
43
+ </playlist>
44
+ END_OF_PLAYLIST
45
+
46
+ xspf = XSPF.new(@playlist_document)
47
+ playlist = XSPF::Playlist.new(xspf)
48
+ tracklist = XSPF::Tracklist.new(playlist)
49
+ @track = tracklist.tracks[0]
50
+ end
51
+
52
+ def test_class
53
+ assert_instance_of(XSPF::Track, @track)
54
+ end
55
+
56
+ def test_identifier
57
+ assert_equal(@track.identifier, "http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793")
58
+ end
59
+
60
+ def test_title
61
+ assert_equal(@track.title, "I Wanna Get High")
62
+ end
63
+
64
+ def test_creator
65
+ assert_equal(@track.creator, "Cypress Hill")
66
+ end
67
+
68
+ def test_duration
69
+ assert_equal(@track.duration, "174613")
70
+ end
71
+
72
+ def test_meta
73
+ assert_equal(@track.meta_rel, "http://musicbrainz.org/track")
74
+ assert_equal(@track.meta_content, "http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793")
75
+ end
76
+
77
+ def test_nil
78
+ assert_nil(@track.album)
79
+ end
80
+
81
+ def test_error
82
+ assert_raise(NoMethodError) { @track.inexistent_method }
83
+ end
84
+
85
+ end
@@ -0,0 +1,69 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'xspf'
4
+ require 'test/unit'
5
+
6
+ class TestTracklist < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @playlist_document = <<END_OF_PLAYLIST
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <playlist version="0" xmlns="http://xspf.org/ns/0/">
12
+ <title>XSPlF it up!</title>
13
+ <creator>Mayhem &amp; Chaos Coordinator</creator>
14
+ <annotation>Just a few songs to enjoy while you XSPlF it up!</annotation>
15
+ <info>http://mayhem-chaos.net/xspf/xspf_it_up.html</info>
16
+ <identifier>http://mayhem-chaos.net/xspf/xspf_it_up/1.0</identifier>
17
+ <attribution>
18
+ <location>ihttp://mayhem-chaos.net/xspf/xspf_it_up.html</location>
19
+ </attribution>
20
+ <trackList>
21
+ <track>
22
+ <identifier>http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</identifier>
23
+ <title>I Wanna Get High</title>
24
+ <creator>Cypress Hill</creator>
25
+ <duration>174613</duration>
26
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</meta>
27
+ </track>
28
+ <track>
29
+ <identifier>bdc846e7-6c26-4193-82a6-8d1b5a4d3429</identifier>
30
+ <title>Smoke Two Joints</title>
31
+ <creator>Sublime</creator>
32
+ <duration>175466</duration>
33
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429</meta>
34
+ </track>
35
+ <track>
36
+ <identifier>http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</identifier>
37
+ <title>Hash Pipe</title>
38
+ <creator>Weezer</creator>
39
+ <duration>186533</duration>
40
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</meta>
41
+ </track>
42
+ </trackList>
43
+ </playlist>
44
+ END_OF_PLAYLIST
45
+
46
+ xspf = XSPF.new(@playlist_document)
47
+ playlist = XSPF::Playlist.new(xspf)
48
+ @tracklist = XSPF::Tracklist.new(playlist)
49
+ end
50
+
51
+ def test_tracklist_class
52
+ assert_instance_of(XSPF::Tracklist, @tracklist)
53
+ end
54
+
55
+ def test_number_of_tracks
56
+ assert_equal(@tracklist.tracks.size, 3)
57
+ end
58
+
59
+ def test_track_class
60
+ @tracklist.tracks.each do |t|
61
+ assert_instance_of(XSPF::Track, t)
62
+ end
63
+ end
64
+
65
+ def test_error
66
+ assert_raise(NoMethodError) { @tracklist.inexistent_method }
67
+ end
68
+
69
+ end
data/test/tc_xspf.rb ADDED
@@ -0,0 +1,64 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+ require 'xspf'
4
+ require 'test/unit'
5
+
6
+ class TestXSPF < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @playlist_document = <<END_OF_PLAYLIST
10
+ <?xml version="1.0" encoding="UTF-8"?>
11
+ <playlist version="0" xmlns="http://xspf.org/ns/0/">
12
+ <title>XSPlF it up!</title>
13
+ <creator>Mayhem &amp; Chaos Coordinator</creator>
14
+ <annotation>Just a few songs to enjoy while you XSPlF it up!</annotation>
15
+ <info>http://mayhem-chaos.net/xspf/xspf_it_up.html</info>
16
+ <identifier>http://mayhem-chaos.net/xspf/xspf_it_up/1.0</identifier>
17
+ <attribution>
18
+ <location>ihttp://mayhem-chaos.net/xspf/xspf_it_up.html</location>
19
+ </attribution>
20
+ <trackList>
21
+ <track>
22
+ <identifier>http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</identifier>
23
+ <title>I Wanna Get High</title>
24
+ <creator>Cypress Hill</creator>
25
+ <duration>174613</duration>
26
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793</meta>
27
+ </track>
28
+ <track>
29
+ <identifier>bdc846e7-6c26-4193-82a6-8d1b5a4d3429</identifier>
30
+ <title>Smoke Two Joints</title>
31
+ <creator>Sublime</creator>
32
+ <duration>175466</duration>
33
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429</meta>
34
+ </track>
35
+ <track>
36
+ <identifier>http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</identifier>
37
+ <title>Hash Pipe</title>
38
+ <creator>Weezer</creator>
39
+ <duration>186533</duration>
40
+ <meta rel="http://musicbrainz.org/track">http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58</meta>
41
+ </track>
42
+ </trackList>
43
+ </playlist>
44
+ END_OF_PLAYLIST
45
+
46
+ @xspf = XSPF.new(@playlist_document)
47
+ end
48
+
49
+ def test_class
50
+ assert_instance_of(XSPF, @xspf)
51
+ end
52
+
53
+ def test_version
54
+ assert_equal(@xspf.version, "1.0")
55
+ end
56
+
57
+ def test_encoding
58
+ assert_equal(@xspf.encoding, "UTF-8")
59
+ end
60
+
61
+ def test_error
62
+ assert_raise(NoMethodError) {@xspf.inexistent_method }
63
+ end
64
+ end
data/test/ts_xspf.rb ADDED
@@ -0,0 +1,9 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "test")
2
+
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'
9
+
data/xspf-expanded.rb ADDED
@@ -0,0 +1,152 @@
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
4
+ end
5
+ 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
8
+ end
9
+ 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
12
+ end
13
+ 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
16
+ end
17
+ 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
20
+ end
21
+ 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
24
+ end
25
+ 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
28
+ end
29
+ 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
32
+ end
33
+ 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
36
+ end
37
+ 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
40
+ end
41
+ 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
44
+ end
45
+ 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
48
+ end
49
+ 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
52
+ end
53
+ 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
56
+ end
57
+ 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
60
+ end
61
+ 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
64
+ end
65
+ 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
68
+ end
69
+ 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
72
+ end
73
+ 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
76
+ end
77
+ 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
80
+ end
81
+ 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
84
+ end
85
+ 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
88
+ end
89
+ 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
92
+ end
93
+ 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
96
+ end
97
+ 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
100
+ end
101
+ 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
104
+ end
105
+ 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
108
+ end
109
+ 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
112
+ end
113
+ 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
116
+ end
117
+ 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
120
+ end
121
+ 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
124
+ end
125
+ 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
128
+ end
129
+ 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
132
+ end
133
+ 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
136
+ end
137
+ 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
140
+ end
141
+ 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
144
+ end
145
+ 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
148
+ end
149
+ 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
152
+ end