Sha256: bd885a024973a31fd8ed19aa49a61e1af373ffc04ede48fe071bf0a036a3fc7e

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

# This code does NOT work because 'pl' is a new object, unrelated to 'x'; and 'tl' is a new object, unrelated to 'pl'

require 'xspf'

f = File.new("playlist.xspf")
x = XSPF.new(f)
pl = XSPF::Playlist.new(x)
tl = XSPF::Tracklist.new(pl)

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 examples/parse_and_generate_wrong.rb
xspf-0.4.1 examples/parse_and_generate_wrong.rb
xspf-0.4.1.1 examples/parse_and_generate_wrong.rb