.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 "POE::Component::Client::MPD 3pm" .TH POE::Component::Client::MPD 3pm "2019-01-19" "perl v5.28.1" "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" POE::Component::Client::MPD \- full\-blown poe\-aware mpd client library .SH "VERSION" .IX Header "VERSION" version 2.001 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 8 \& use POE qw{ Component::Client::MPD }; \& POE::Component::Client::MPD\->spawn( { \& host => \*(Aqlocalhost\*(Aq, \& port => 6600, \& password => \*(Aqs3kr3t\*(Aq, # mpd password \& alias => \*(Aqmpd\*(Aq, # poe alias \& status_msgs_to => \*(Aqmyapp\*(Aq, # session to send status info to \& } ); \& \& # ... later on ... \& $_[KERNEL]\->post( mpd => \*(Aqnext\*(Aq ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1POCOCM\s0 gives a clear message-passing interface (sitting on top of \s-1POE\s0) 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 \s-1POCOCM\s0 object is created. .PP Commands are then sent to the server as messages are passed. .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 "alias" .IX Subsection "alias" A string to alias the newly created \s-1POE\s0 session. Defaults to \f(CW\*(C`mpd\*(C'\fR. .SS "status_msgs_to" .IX Subsection "status_msgs_to" A session (name or id) to whom to send connection status to. Optional, although recommended. No default. When this is done, pococm will send *additional* events to the session, such as: \f(CW\*(C`mpd_connected\*(C'\fR when pococm is connected, \f(CW\*(C`mpd_disconnected\*(C'\fR when pococm is disconnected, etc. You thus need to register some handlers for those events. .SH "METHODS" .IX Header "METHODS" .ie n .SS "my $id = POE::Component::Client::MPD\->spawn( \e%params );" .el .SS "my \f(CW$id\fP = POE::Component::Client::MPD\->spawn( \e%params );" .IX Subsection "my $id = POE::Component::Client::MPD->spawn( %params );" This method will create a \s-1POE\s0 session responsible for communicating with mpd. It will return the poe id of the session newly created. You can tune it by passing some arguments as a hash reference. See the attributes for allowed values. .SH "PUBLIC EVENTS ACCEPTED" .IX Header "PUBLIC EVENTS ACCEPTED" .SS "MPD-related events" .IX Subsection "MPD-related events" The goal of a \s-1POCOCM\s0 session is to drive a remote \s-1MPD\s0 server. This can be achieved by a lot of events. Due to their sheer number, they have been regrouped logically in modules. .PP However, note that to use those events, you need to send them to the \&\s-1POCOCM\s0 session that you created with \f(CW\*(C`spawn()\*(C'\fR (see above). Indeed, the logical split is only internal: you are to use the same peer. .PP For a list of public events that update and/or query \s-1MPD,\s0 see embedded pod in: .IP "\(bu" 4 POE::Component::Client::MPD::Commands for general commands .IP "\(bu" 4 POE::Component::Client::MPD::Playlist for playlist-related commands. Those events begin with \f(CW\*(C`pl.\*(C'\fR. .IP "\(bu" 4 POE::Component::Client::MPD::Collection for collection\- related commands. Those events begin with \f(CW\*(C`coll.\*(C'\fR. .SS "disconnect( )" .IX Subsection "disconnect( )" Request the \s-1POCOCM\s0 to be shutdown. Leave mpd running. Generally sent when one wants to exit her program. .SH "EVENTS FIRED" .IX Header "EVENTS FIRED" A \s-1POCOCM\s0 session will fire events, either to answer an incoming event, or to inform about some changes regarding the remote \s-1MPD\s0 server. .SS "Answer events" .IX Subsection "Answer events" For each incoming event received by the \s-1POCOCM\s0 session, it will fire back one of the following answers: .IP "\(bu" 4 mpd_result( \f(CW$msg\fR, \f(CW$answer\fR ) .Sp Indicates a success. \f(CW$msg\fR is a POE::Component::Client::MPD::Message object with the original request, to identify the issued command (see POE::Component::Client::MPD::Message pod for more information). Its \&\f(CW\*(C`status()\*(C'\fR attribute is true, further confirming success. .Sp \&\f(CW$answer\fR is what has been answered by the \s-1MPD\s0 server. Depending on the command, it can be either: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`undef\*(C'\fR: commands \f(CW\*(C`play\*(C'\fR, etc. .IP "\(bu" 4 an Audio::MPD::Common::Stats object: command \f(CW\*(C`stats\*(C'\fR .IP "\(bu" 4 an Audio::MPD::Common::Status object: command \f(CW\*(C`status\*(C'\fR .IP "\(bu" 4 an Audio::MPD::Common::Item object: commands \f(CW\*(C`song\*(C'\fR, etc. .IP "\(bu" 4 an array reference: commands \f(CW\*(C`coll.files\*(C'\fR, etc. .IP "\(bu" 4 etc. .RE .RS 4 .Sp Refer to the documentation of each event to know what type of answer you can expect. .RE .IP "\(bu" 4 mpd_error( \f(CW$msg\fR, \f(CW$errstr\fR ) .Sp Indicates a failure. \f(CW$msg\fR is a POE::Component::Client::MPD::Message object with the original request, to identify the issued command (see POE::Component::Client::MPD::Message pod for more information). Its \&\f(CW\*(C`status()\*(C'\fR attribute is false, further confirming failure. .Sp \&\f(CW$errstr\fR is what the error message as returned been answered by the \&\s-1MPD\s0 server. .SS "Auto-generated events" .IX Subsection "Auto-generated events" If you supplied the \f(CW\*(C`status_msgs_to\*(C'\fR attribute, the following events are fired to this peer by pococm: .IP "\(bu" 4 mpd_connect_error( \f(CW$reason\fR ) .Sp Called when pococm-conn could not connect to a mpd server. It can be either retriable, or fatal. Check \f(CW$reason\fR for more information. .IP "\(bu" 4 mpd_connected( ) .Sp Called when pococm-conn made sure we're talking to a mpd server. .IP "\(bu" 4 mpd_disconnected( ) .Sp Called when pococm-conn has been disconnected from mpd server. .SH "SEE ALSO" .IX Header "SEE ALSO" You can find more information on the mpd project on its homepage at , or its wiki . You may want to have a look at Audio::MPD, a non\-\s-1POE\s0 aware module to access \s-1MPD.\s0 .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 (same as Audio::MPD) .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.