2 # This program is free software; you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation; either version 2 of the License, or
5 # (at your option) any later version.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 package Audio
::MPD
::Status
;
23 use base qw
[ Class
::Accessor
::Fast
];
24 __PACKAGE__
->mk_accessors
25 ( qw
[ audio bitrate error playlist playlistlength random
26 repeat song songid
state time volume xfade
] );
33 # my $status = Audio::MPD::Status->new( @output )
35 # The constructor for the class Audio::MPD::Status. @output is what MPD
36 # server returns to the status command.
43 map { /^([^:]+):\s+(.+)$/ ?
($1 => $2) : () }
58 Audio::MPD::Status - class representing MPD status
63 my $status = $mpd->status;
68 The MPD server maintains some information on its current state. Those
69 information can be queried with the C<status()> method of C<Audio::MPD>.
70 This method returns an C<Audio::MPD::Status> object, containing all
73 Note that an C<Audio::MPD::Status> object does B<not> update itself regularly,
74 and thus should be used immediately.
85 The C<new()> method is the constructor for the C<Audio::MPD::Status> class.
86 It is called internally by the C<status()> method of C<Audio::MPD>, with the
87 result of the C<status> command sent to MPD server.
89 Note: one should B<never> ever instantiate an C<Audio::MPD::Status> object
90 directly - use the C<status()> method of C<Audio::MPD>.
97 Once created, one can access to the following members of the object:
103 A string with the sample rate of the song currently playing, number of bits
104 of the output and number of channels (2 for stereo) - separated by a colon.
108 The instantaneous bitrate in kbps.
112 May appear in special error cases, such as when disabling output.
117 The playlist version number, that changes every time the playlist is updated.
119 =item playlistlength()
121 The number of songs in the playlist.
125 Whether the playlist is read randomly or not.
129 Whether the song is repeated or not.
133 The offset of the song currently played in the playlist.
137 The song id (MPD id) of the song currently played.
141 The state of MPD server. Either C<play>, C<stop> or C<pause>.
145 A string with the time played so far and the total time of the current song,
146 separated by a colon.
150 The current MPD volume - an integer between 0 and 100.
154 The crossfade in seconds.
158 Please note that those accessors are read-only: changing a value will B<not>
159 change the current settings of MPD server. Use C<Audio::MPD> methods to
165 You can find more information on the mpd project on its homepage at
166 L<http://www.musicpd.org>, or its wiki L<http://mpd.wikia.com>.
168 Regarding this Perl module, you can report bugs on CPAN via
169 L<http://rt.cpan.org/Public/Bug/Report.html?Queue=Audio-MPD>.
171 Audio::MPD development takes place on <audio-mpd@googlegroups.com>: feel free
172 to join us. (use L<http://groups.google.com/group/audio-mpd> to sign in). Our
173 subversion repository is located at L<https://svn.musicpd.org>.
178 Jerome Quelin <jquelin@cpan.org>
181 =head1 COPYRIGHT AND LICENSE
183 Copyright (c) 2007 Jerome Quelin <jquelin@cpan.org>
186 This program is free software; you can redistribute it and/or modify
187 it under the terms of the GNU General Public License as published by
188 the Free Software Foundation; either version 2 of the License, or
189 (at your option) any later version.
191 This program is distributed in the hope that it will be useful,
192 but WITHOUT ANY WARRANTY; without even the implied warranty of
193 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194 GNU General Public License for more details.