NAME

App::Pimpd::Playlist::Randomize - Package exporting various randomizing functions

SYNOPSIS

use App::Pimpd;
use App::Pimpd::Playlist::Randomize;

my @random_songs = randomize(10);

my @random_albums = randomize_albums(5);

my $random_song = random_track_in_playlist();

DESCRIPTION

App::Pimpd::Playlist::Randomize provides functions for altering the current playlist in random ways.

EXPORTS

randomize()
my @randoms = randomize(42);
my $randoms = randomize();

Parameters: $integer, $artist

Returns: @songs | \@songs

In list context, returns a list with n random paths ( all relative to MPD ). If a second argument is provided it's interpreted as an artist name. The list will be crafted together with random paths from that artist.

In scalar context, returns an array reference.

If called with zero arguments, a default value of 100 totally random songs is used.

random_albums();
my @random_albums       = random_albums(42);
my $random_albums_songs = random_albums();

Parameters: $integer | NONE

Returns: @songs | scalar(@songs)

In list context, returns a list with the paths to the songs of n random albums.

In scalar context, returns the number of songs found on the n random albums.

If called with zero arguments, a default value of 10 albums is used.

random_track_in_playlist()
my $position = random_track_in_playlist();
$mpd->play($position);

Parameters: NONE

Returns: $playlist_pos

Returns a valid playlist position id, used to reference a song in the playlist.

SEE ALSO

App::Pimpd::Playlist

AUTHOR

Magnus Woldrich
CPAN ID: WOLDRICH
magnus@trapd00r.se
http://japh.se

COPYRIGHT

Copyright (C) 2010, 2011 Magnus Woldrich. All right reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.