NAME

XMMS::InfoPipe::Playlist - A small module to gather the information produced by the playlist-infopipe plugin for XMMS

SYNOPSIS

        use XMMS::InfoPipe::Playlist;
	
        my $pl = XMMS::InfoPipe::Playlist->new();
        
        for ($pl->get_playlist()) {
            print "Position: $_->{position}\n";
            print "Title: $_->{title}\n";
            print "File: $_->{file}\n\n";
        }

DESCRIPTION

This module was written to provide a way to snag the current XMMS playlist from the pipe produced by the xmms-playlist-infopipe plugin for XMMS.

Nota Bene: If the XMMS plugin isn't enabled, then this module will NOT return results as expected (if it even works).

METHODS

new

my $pl = XMMS::InfoPipe::Playlist->new();

Creates a new XMMS::InfoPipe::Playlist instance. By default this parses the file before returning the object. This will undoubtedly cause some initial slowdown (the bottleneck of XMMS::InfoPipe::Playlist is when it must grab information from the named pipe the XMMS plugin provides), and so you may disable this first parsing by specifying a false value to ForceParse. For example:

my $pl = XMMS::InfoPipe::Playlist->new(ForceParse => 0);

will create the object and immediately return it, without first populating it with the information from XMMS. This means that before trying to obtain this information, you should first call $pl->update_playlist().

get_playlist

@list = $pl->get_playlist();

Returns an array of hashrefs that represents the current playlist.

xmms_is_running

$pl->xmms_is_running()

Returns 1 if XMMS is running and 0 if not. This relies on the fact that the named pipe does not exist if XMMS is not running. If the infopipe plugin isn't enabled, this will also return 0.

update_playlist

$pl->update_playlist()

Updates $pl->{playlist}.

VARIABLES

$XMMS::InfoPipe::Playlist::PIPE

$XMMS::InfoPipe::Playlist::PIPE = '/tmp/other-name';

This variable defaults to /tmp/xmms-playlist-info which should be a symlink (created by xmms-playlist-infopipe) to the real named pipe (something like /tmp/xmms-playlist-info_user.0). If for whatever reason you need to change it (maybe you have a file generated by something else that follows the same format as xmms-playlist-infopipe), just set it before update_playlist is called (by default that means before new is called) for the right file to be used.

LICENSE

This module is free software, and may be distributed under the same terms as Perl itself.

AUTHOR

Copyright (C) 2003, Thomas R. Sibley tsibley@cpan.org