The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XML::XSPF - API for reading & writing XSPF Playlists

SYNOPSIS

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;

DESCRIPTION

This is a parser and generator for the XSPF playlist format.

METHODS

  • 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.

BUGS

  • Extensions are not handled yet.

  • Multiple xmlns attributes are not handled properly.

  • Only UTF-8 Encoding is handled currently.

SEE ALSO

XSPF Version 1 Spec:
http://www.xspf.org/xspf-v1.html
Slim Devices:
http://www.slimdevices.com/

AUTHOR

Dan Sully <daniel | at | cpan.org> & Slim Devices, Inc.

COPYRIGHT AND LICENSE

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.