XML::XSPF - API for reading & writing XSPF Playlists
use strict; use XML::XSPF; use XML::XSPF::Track; my $playlist = XML::XSPF->parse($filenameOrString); print "count: " . $playlist->trackList . "\n"; for my $track ($playlist->trackList) { if ($track->title) { print $track->title . "\n"; } if ($track->location) { print $track->location . "\n"; } } my $xspf = XML::XSPF->new; my $track = XML::XSPF::Track->new; $track->title('Prime Evil'); $track->location('http://orb.com/PrimeEvil.mp3'); $xspf->title('Bicycles & Tricycles'); $xspf->trackList($track); print $xspf->toString;
This is a parser and generator for the XSPF playlist format.
new()
Create a new instance of an XML::XSPF object.
parse( filenameOrString )
Create a XML::XSPF object, parsing the playlist in filenameOrString
toString()
Serialize a XML::XSPF object back to XML
accessors
Call ->title, ->creator, ->trackList, etc to get the values for the corresponding XSPF nodes.
Extensions are not handled yet.
Multiple xmlns attributes are not handled properly.
Only UTF-8 Encoding is handled currently.
http://www.xspf.org/xspf-v1.html
http://www.slimdevices.com/
Dan Sully <daniel | at | cpan.org> & Slim Devices, Inc.
Copyright (c) 2006 Dan Sully & Slim Devices, Inc. All rights reserved. Copyright (c) 2006-2009 Dan Sully. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install XML::XSPF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::XSPF
CPAN shell
perl -MCPAN -e shell install XML::XSPF
For more information on module installation, please visit the detailed CPAN module installation guide.