Audio-MPD

 view release on metacpan or  search on metacpan

lib/Audio/MPD/Playlist.pm  view on Meta::CPAN


=pod

=head1 NAME

Audio::MPD::Playlist - class to mess MPD's playlist

=head1 VERSION

version 2.004

=head1 SYNOPSIS

    $mpd->playlist->shuffle;
    # and lots of other methods

=head1 DESCRIPTION

L<Audio::MPD::Playlist> is a class meant to access & update MPD's
playlist.

Note that you're not supposed to call the constructor yourself, an
L<Audio::MPD::Playlist> is automatically created for you during the
creation of an L<Audio::MPD> object - it can then be used with the
C<playlist()> accessor.

=head1 RETRIEVING INFORMATION

=head2 as_items

    my @items = $pl->as_items;

Return an array of L<Audio::MPD::Common::Item::Song>s, one for each of the
songs in the current playlist.

=head2 items_changed_since

    my @items = $pl->items_changed_since( $plversion );

Return a list with all the songs (as L<Audio::MPD::Common::Item::Song> objects)
added to the playlist since playlist C<$plversion>.

=head1 ADDING / REMOVING SONGS

=head2 add

    $pl->add( $path [, $path [...] ] );

Add the songs identified by C<$path> (relative to MPD's music directory) to the
current playlist. No return value.

=head2 delete

    $pl->delete( $song [, $song [...] ] );

Remove the specified C<$song> numbers (starting from 0) from the current
playlist. No return value.

=head2 deleteid

    $pl->deleteid( $songid [, $songid [...] ] );

Remove the specified C<$songid>s (as assigned by mpd when inserted in playlist)
from the current playlist. No return value.

=head2 clear

    $pl->clear;

Remove all the songs from the current playlist. No return value.

=head2 crop

    $pl->crop;

Remove all of the songs from the current playlist B<except> the
song currently playing.

=head1 CHANGING PLAYLIST ORDER

=head2 shuffle

    $pl->shuffle;

Shuffle the current playlist. No return value.

=head2 swap

    $pl->swap( $song1, $song2 );

Swap positions of song number C<$song1> and C<$song2> in the current
playlist. No return value.

=head2 swapid

    $pl->swapid( $songid1, $songid2 );

Swap the postions of song ID C<$songid1> with song ID C<$songid2> in the
current playlist. No return value.

=head2 move

    $pl->move( $song, $newpos );

Move song number C<$song> to the position C<$newpos>. No return value.

=head2 moveid

    $pl->moveid( $songid, $newpos );

Move song ID C<$songid> to the position C<$newpos>. No return value.

=head1 MANAGING PLAYLISTS

=head2 load

    $pl->load( $playlist );

Load list of songs from specified C<$playlist> file. No return value.

=head2 save

    $pl->save( $playlist );

Save the current playlist to a file called C<$playlist> in MPD's playlist
directory. No return value.

=head2 rm

    $pl->rm( $playlist );

Delete playlist named C<$playlist> from MPD's playlist directory. No
return value.

=head1 AUTHOR

Jerome Quelin

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Jerome Quelin.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.496 second using v1.01-cache-2.11-cpan-5735350b133 )