2 # This file is part of Audio::MPD::Common
3 # Copyright (c) 2007 Jerome Quelin, all rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the same terms as Perl itself.
10 package Audio
::MPD
::Common
::Status
;
15 use Audio
::MPD
::Common
::Time
;
17 use base qw
[ Class
::Accessor
::Fast
];
18 __PACKAGE__
->mk_accessors
19 ( qw
[ audio bitrate error playlist playlistlength random
20 repeat song songid
state time volume updating_db xfade
] );
22 #our ($VERSION) = '$Rev: 5865 $' =~ /(\d+)/;
29 # my $status = Audio::MPD::Common::Status->new( \%kv )
31 # The constructor for the class Audio::MPD::Common::Status. %kv is
32 # a cooked output of what MPD server returns to the status command.
35 my ($class, $kv) = @_;
37 $kv{time} = Audio
::MPD
::Common
::Time
->new( delete $kv{time} );
49 Audio::MPD::Common::Status - class representing MPD status
54 print $status->bitrate;
59 The MPD server maintains some information on its current state. Those
60 information can be queried with mpd modules. Some of those information
61 are served to you as an C<Audio::MPD::Common::Status> object.
63 Note that an C<Audio::MPD::Common::Status> object does B<not> update
64 itself regularly, and thus should be used immediately.
75 The C<new()> method is the constructor for the C<Audio::MPD::Common::Status>
78 Note: one should B<never> ever instantiate an C<Audio::MPD::Common::Status>
79 object directly - use the mpd modules instead.
86 Once created, one can access to the following members of the object:
90 =item $status->audio()
92 A string with the sample rate of the song currently playing, number of bits
93 of the output and number of channels (2 for stereo) - separated by a colon.
96 =item $status->bitrate()
98 The instantaneous bitrate in kbps.
101 =item $status->error()
103 May appear in special error cases, such as when disabling output.
106 =item $status->playlist()
108 The playlist version number, that changes every time the playlist is updated.
111 =item $status->playlistlength()
113 The number of songs in the playlist.
116 =item $status->random()
118 Whether the playlist is read randomly or not.
121 =item $status->repeat()
123 Whether the song is repeated or not.
126 =item $status->song()
128 The offset of the song currently played in the playlist.
131 =item $status->songid()
133 The song id (MPD id) of the song currently played.
136 =item $status->state()
138 The state of MPD server. Either C<play>, C<stop> or C<pause>.
141 =item $status->time()
143 An C<Audio::MPD::Common::Time> object, representing the time elapsed /
144 remainging and total. See the associated pod for more details.
147 =item $status->updating_db()
149 An integer, representing the current update job.
152 =item $status->volume()
154 The current MPD volume - an integer between 0 and 100.
157 =item $status->xfade()
159 The crossfade in seconds.
164 Please note that those accessors are read-only: changing a value will B<not>
165 change the current settings of MPD server. Use the mpd modules to alter the
175 =item L<POE::Component::Client::MPD>
182 Jerome Quelin, C<< <jquelin at cpan.org> >>
185 =head1 COPYRIGHT & LICENSE
187 Copyright (c) 2007 Jerome Quelin, all rights reserved.
189 This program is free software; you can redistribute it and/or modify
190 it under the same terms as Perl itself.