.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Audio::MPD 3pm" .TH Audio::MPD 3pm "2022-06-08" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Audio::MPD \- class to talk to MPD (Music Player Daemon) servers .SH "VERSION" .IX Header "VERSION" version 2.004 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Audio::MPD; \& \& my $mpd = Audio::MPD\->new; \& $mpd\->play; \& sleep 10; \& $mpd\->next; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Audio::MPD gives a clear object-oriented interface for talking to and controlling \s-1MPD\s0 (Music Player Daemon) servers. A connection to the \s-1MPD\s0 server is established as soon as a new Audio::MPD object is created. .PP Since mpd is still in 0.x versions, Audio::MPD sticks to latest mpd (0.15 as time of writing) protocol & behaviour, and does \fBnot\fR try to maintain backward compatibility. .PP Note that the module will by default connect to mpd before sending any command, and will disconnect after the command has been issued. This scheme is far from optimal, but allows us not to care about timeout disconnections. Because of that, the \f(CW\*(C`idle\*(C'\fR command (new in mpd 0.14) is \fBnot\fR (and will not) be supported in Audio::MPD. This will be implemented in POE::Component::Client::MPD. .PP \&\fB/!\e\fR Note that Audio::MPD is using high-level, blocking sockets. This means that if the mpd server is slow, or hangs for whatever reason, or even crash abruptly, the program will be hung forever in this sub. The POE::Component::Client::MPD module is way safer \- you're advised to use it instead of Audio::MPD. Or you can try to set \f(CW\*(C`conntype\*(C'\fR to \&\f(CW$REUSE\fR (see Audio::MPD constructor for more details), but you would be then on your own to deal with disconnections. .SS "Searching the collection" .IX Subsection "Searching the collection" To search the collection, use the \f(CW\*(C`collection()\*(C'\fR accessor, returning the associated Audio::MPD::Collection object. You will then be able to call: .PP .Vb 1 \& $mpd\->collection\->all_songs; .Ve .PP See Audio::MPD::Collection documentation for more details on available methods. .SS "Handling the playlist" .IX Subsection "Handling the playlist" To update the playlist, use the \f(CW\*(C`playlist()\*(C'\fR accessor, returning the associated Audio::MPD::Playlist object. You will then be able to call: .PP .Vb 1 \& $mpd\->playlist\->clear; .Ve .PP See Audio::MPD::Playlist documentation for more details on available methods. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "host" .IX Subsection "host" The hostname where \s-1MPD\s0 is running. Defaults to environment var \&\f(CW\*(C`MPD_HOST\*(C'\fR, then to 'localhost'. Note that \f(CW\*(C`MPD_HOST\*(C'\fR can be of the form \f(CW\*(C`password@host:port\*(C'\fR (each of \f(CW\*(C`password@\*(C'\fR or \f(CW\*(C`:port\*(C'\fR can be omitted). .SS "port" .IX Subsection "port" The port that \s-1MPD\s0 server listens to. Defaults to environment var \&\f(CW\*(C`MPD_PORT\*(C'\fR, then to parsed \f(CW\*(C`MPD_HOST\*(C'\fR (cf above), then to 6600. .SS "password" .IX Subsection "password" The password to access special \s-1MPD\s0 functions. Defaults to environment var \f(CW\*(C`MPD_PASSWORD\*(C'\fR, then to parsed \f(CW\*(C`MPD_HOST\*(C'\fR (cf above), then to empty string. .SS "conntype" .IX Subsection "conntype" Change how the connection to mpd server is handled. It should be of a \&\f(CW\*(C`CONNTYPE\*(C'\fR type (cf Audio::MPD::Types). Use either the \f(CW\*(C`reuse\*(C'\fR string to reuse the same connection or \f(CW\*(C`once\*(C'\fR to open a new connection per command (default). .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& my $mpd = Audio::MPD\->new( \e%opts ); .Ve .PP This is the constructor for Audio::MPD. One can specify any of the attributes (cf above). .SH "CONTROLLING THE SERVER" .IX Header "CONTROLLING THE SERVER" .SS "ping" .IX Subsection "ping" .Vb 1 \& $mpd\->ping; .Ve .PP Sends a ping command to the mpd server. .SS "version" .IX Subsection "version" .Vb 1 \& my $version = $mpd\->version; .Ve .PP Return mpd's version number as advertised during connection. Note that mpd returns \fBprotocol\fR version when connected. This protocol version can differ from the real mpd version. eg, mpd version 0.13.2 is \&\*(L"speaking\*(R" and thus advertising version 0.13.0. .SS "kill" .IX Subsection "kill" .Vb 1 \& $mpd\->kill; .Ve .PP Send a message to the \s-1MPD\s0 server telling it to shut down. .SS "set_password" .IX Subsection "set_password" .Vb 1 \& $mpd\->set_password( [$password] ); .Ve .PP Change password used to communicate with \s-1MPD\s0 server to \f(CW$password\fR. Empty string is assumed if \f(CW$password\fR is not supplied. .SS "updatedb" .IX Subsection "updatedb" .Vb 1 \& $mpd\->updatedb( [$path] ); .Ve .PP Force mpd to recan its collection. If \f(CW$path\fR (relative to \s-1MPD\s0's music directory) is supplied, \s-1MPD\s0 will only scan it \- otherwise, \s-1MPD\s0 will rescan its whole collection. .SS "urlhandlers" .IX Subsection "urlhandlers" .Vb 1 \& my @handlers = $mpd\->urlhandlers; .Ve .PP Return an array of supported \s-1URL\s0 schemes. .SH "HANDLING VOLUME & OUTPUT" .IX Header "HANDLING VOLUME & OUTPUT" .SS "volume" .IX Subsection "volume" .Vb 1 \& $mpd\->volume( [+][\-]$volume ); .Ve .PP Sets the audio output volume percentage to absolute \f(CW$volume\fR. If \&\f(CW$volume\fR is prefixed by '+' or '\-' then the volume is changed relatively by that value. .SS "outputs" .IX Subsection "outputs" .Vb 1 \& my @outputs = $mpd\->outputs( ); .Ve .PP Return a list of \f(CW\*(C`Audio::MPD::Common::Outputs\*(C'\fR with all outputs available within \s-1MPD.\s0 .SS "output_enable" .IX Subsection "output_enable" .Vb 1 \& $mpd\->output_enable( $output ); .Ve .PP Enable the specified audio output. \f(CW$output\fR is the \s-1ID\s0 of the audio output. .SS "output_disable" .IX Subsection "output_disable" .Vb 1 \& $mpd\->output_disable( $output ); .Ve .PP Disable the specified audio output. \f(CW$output\fR is the \s-1ID\s0 of the audio output. .SH "RETRIEVING INFO FROM CURRENT STATE" .IX Header "RETRIEVING INFO FROM CURRENT STATE" .SS "stats" .IX Subsection "stats" .Vb 1 \& my $stats = $mpd\->stats; .Ve .PP Return an Audio::MPD::Common::Stats object with the current statistics of \s-1MPD.\s0 See the associated pod for more information. .SS "status" .IX Subsection "status" .Vb 1 \& my $status = $mpd\->status; .Ve .PP Return an Audio::MPD::Common::Status object with various information on current \s-1MPD\s0 server settings. See the associated pod for more information. .SS "current" .IX Subsection "current" .Vb 1 \& my $song = $mpd\->current; .Ve .PP Return an Audio::MPD::Common::Item::Song representing the song currently playing. .SS "song" .IX Subsection "song" .Vb 1 \& my $song = $mpd\->song( [$song] ); .Ve .PP Return an Audio::MPD::Common::Item::Song representing the song number \&\f(CW$song\fR. If \f(CW$song\fR is not supplied, returns the current song. .SS "songid" .IX Subsection "songid" .Vb 1 \& my $song = $mpd\->songid( [$songid] ); .Ve .PP Return an Audio::MPD::Common::Item::Song representing the song with id \&\f(CW$songid\fR. If \f(CW$songid\fR is not supplied, returns the current song. .SH "ALTERING MPD SETTINGS" .IX Header "ALTERING MPD SETTINGS" .SS "repeat" .IX Subsection "repeat" .Vb 1 \& $mpd\->repeat( [$repeat] ); .Ve .PP Set the repeat mode to \f(CW$repeat\fR (1 or 0). If \f(CW$repeat\fR is not specified then the repeat mode is toggled. .SS "random" .IX Subsection "random" .Vb 1 \& $mpd\->random( [$random] ); .Ve .PP Set the random mode to \f(CW$random\fR (1 or 0). If \f(CW$random\fR is not specified then the random mode is toggled. .SS "fade" .IX Subsection "fade" .Vb 1 \& $mpd\->fade( [$seconds] ); .Ve .PP Enable crossfading and set the duration of crossfade between songs. If \&\f(CW$seconds\fR is not specified or \f(CW$seconds\fR is 0, then crossfading is disabled. .SH "CONTROLLING PLAYBACK" .IX Header "CONTROLLING PLAYBACK" .SS "play" .IX Subsection "play" .Vb 1 \& $mpd\->play( [$song] ); .Ve .PP Begin playing playlist at song number \f(CW$song\fR. If no argument supplied, resume playing. .SS "playid" .IX Subsection "playid" .Vb 1 \& $mpd\->playid( [$songid] ); .Ve .PP Begin playing playlist at song \s-1ID\s0 \f(CW$songid\fR. If no argument supplied, resume playing. .SS "pause" .IX Subsection "pause" .Vb 1 \& $mpd\->pause( [$state] ); .Ve .PP Pause playback. If \f(CW$state\fR is 0 then the current track is unpaused, if \f(CW$state\fR is 1 then the current track is paused. .PP Note that if \f(CW$state\fR is not given, pause state will be toggled. .SS "stop" .IX Subsection "stop" .Vb 1 \& $mpd\->stop; .Ve .PP Stop playback. .SS "next" .IX Subsection "next" .Vb 1 \& $mpd\->next; .Ve .PP Play next song in playlist. .SS "prev" .IX Subsection "prev" .Vb 1 \& $mpd\->prev; .Ve .PP Play previous song in playlist. .SS "seek" .IX Subsection "seek" .Vb 1 \& $mpd\->seek( $time, [$song]); .Ve .PP Seek to \f(CW$time\fR seconds in song number \f(CW$song\fR. If \f(CW$song\fR number is not specified then the perl module will try and seek to \f(CW$time\fR in the current song. .SS "seekid" .IX Subsection "seekid" .Vb 1 \& $mpd\->seekid( $time, $songid ); .Ve .PP Seek to \f(CW$time\fR seconds in song \s-1ID\s0 \f(CW$songid\fR. If \f(CW$song\fR number is not specified then the perl module will try and seek to \f(CW$time\fR in the current song. .SH "SEE ALSO" .IX Header "SEE ALSO" You can find more information on the mpd project on its homepage at .wikia.com>. .PP Original code (2005) by Tue Abrahamsen \f(CW\*(C`\*(C'\fR, documented in 2006 by Nicholas J. Humfrey \f(CW\*(C`\*(C'\fR. .PP You can look for information on this module at: .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .IP "\(bu" 4 See open / report bugs .Sp .IP "\(bu" 4 Mailing-list .Sp .IP "\(bu" 4 Git repository .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .SH "AUTHOR" .IX Header "AUTHOR" Jerome Quelin .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2007 by Jerome Quelin. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.