Sha256: 0ec31c9d2d12fd4d9419959f385d9188aa20c4c70bf8ad3017d8ff4979248d35

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

# This is the right way to modify an existing XSPF document

require 'xspf'

f = File.new("playlist.xspf")
x = XSPF.new(f)
pl = x.playlist
tl = pl.tracklist

some_other_track = 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'
        } )

tl << some_other_track
pl.title = 'My modified playlist'
f = File.open('playlist.xspf', 'w')
f.write(x.to_xml)
f.close

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xspf-0.4.1.1 examples/parse_and_generate_right.rb
xspf-0.4 examples/parse_and_generate_right.rb
xspf-0.4.1 examples/parse_and_generate_right.rb