[Playlist] [ANN] XSPF for Ruby 0.4

Pau Garcia i Quiles pgquiles at elpauer.org
Wed Nov 1 20:52:58 UTC 2006


On Tuesday 31 October 2006 11:25, Ivo Emanuel Gonçalves wrote:

> On 10/30/06, Pau Garcia i Quiles <pgquiles at elpauer.org> wrote:
> >   XSPF for Ruby is a pure-Ruby XML Shareable Playlist Format parser and
> > generator.
> 
> Very nice.  Any chance of it also importing other playlists and
> convert it to XSPF?

Not automatically. It'd be trivial to do it for M3U:

require 'xspf'

f = File.open('playlist.m3u', 'r')
tl = XSPF::Tracklist.new
f.each { |line| tl << XSPF::Track.new( { :location => line } ) unless line 
=~ /^#EXT/ }
pl = XSPF::Playlist.new( { :tracklist => tl } )
x = XSPF.new( { :playlist => pl } )
f.write(x.to_xml)
f.close

On the other hand, I think XSLT transforms would be a better approach to this 
problem.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.musicbrainz.org/pipermail/playlist/attachments/20061101/5db77da5/attachment.pgp


More information about the Playlist mailing list