NAME XMMS::InfoPipe - A small module to gather the information produced by the infopipe plugin for XMMS SYNOPSIS use XMMS::InfoPipe; my $xmms = XMMS::InfoPipe->new(); print "Currently ", $xmms->{info}->{Status}, ": ", $xmms->{info}->{Title}; DESCRIPTION This module was written to provide a way to snag the information from the file produced by the xmms-infopipe plugin for XMMS. With only a few convenience methods, all of the information that the plugin provides can be obtained from the "$xmms->{info}" hashref. 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 $xmms = XMMS::InfoPipe->new(); Creates a new XMMS::InfoPipe instance. By default this parses the file before returning the object. This will undoubtedly cause some initial slowdown (the bottleneck of XMMS::InfoPipe 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 $xmms = XMMS::InfoPipe->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 "$xmms->update_info". is_running $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. is_playing $xmms->is_playing() Returns 1 if XMMS is playing a song and 0 if not. is_paused $xmms->is_paused() Returns 1 if XMMS is paused and 0 if not. update_info $xmms->update_info() Updates "$xmms->{info}" and returns the updated hashref for convenience. _parse $xmms->_parse Internal function that parses data from the info pipe and returns a hashref. You shouldn't need to use this. VARIABLES $XMMS::InfoPipe::PIPE $XMMS::InfoPipe::PIPE = '/tmp/other-name'; This variable defaults to "/tmp/xmms-info" which should be a symlink (created by xmms-infopipe) to the real named pipe (something like "/tmp/xmms-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-infopipe), just set it before "update_info" is called (by default that means before "new" is called) for the right file to be used. INFORMATION AVAILABLE As of version 1.3 of the xmms-infopipe plugin, the following information is available: XMMS protocol version InfoPipe Plugin version Status Tunes in playlist Currently playing uSecPosition Position uSecTime Time Current bitrate Samping Frequency Channels Title File To get this information, just use the corresponding key name above. 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"