]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/mpfire/perl/Audio/MPD/Common/Status.pm
Finalized core13 and redirector fixes
[people/pmueller/ipfire-2.x.git] / config / mpfire / perl / Audio / MPD / Common / Status.pm
CommitLineData
83d20a45
CS
1#
2# This file is part of Audio::MPD::Common
3# Copyright (c) 2007 Jerome Quelin, all rights reserved.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the same terms as Perl itself.
7#
8#
9
10package Audio::MPD::Common::Status;
11
12use warnings;
13use strict;
14
15use Audio::MPD::Common::Time;
16
17use 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 ] );
21
22#our ($VERSION) = '$Rev: 5865 $' =~ /(\d+)/;
23
24
25#--
26# Constructor
27
28#
29# my $status = Audio::MPD::Common::Status->new( \%kv )
30#
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.
33#
34sub new {
35 my ($class, $kv) = @_;
36 my %kv = %$kv;
37 $kv{time} = Audio::MPD::Common::Time->new( delete $kv{time} );
38 bless \%kv, $class;
39 return \%kv;
40}
41
421;
43
44__END__
45
46
47=head1 NAME
48
49Audio::MPD::Common::Status - class representing MPD status
50
51
52=head1 SYNOPSIS
53
54 print $status->bitrate;
55
56
57=head1 DESCRIPTION
58
59The MPD server maintains some information on its current state. Those
60information can be queried with mpd modules. Some of those information
61are served to you as an C<Audio::MPD::Common::Status> object.
62
63Note that an C<Audio::MPD::Common::Status> object does B<not> update
64itself regularly, and thus should be used immediately.
65
66
67=head1 METHODS
68
69=head2 Constructor
70
71=over 4
72
73=item new( \%kv )
74
75The C<new()> method is the constructor for the C<Audio::MPD::Common::Status>
76class.
77
78Note: one should B<never> ever instantiate an C<Audio::MPD::Common::Status>
79object directly - use the mpd modules instead.
80
81=back
82
83
84=head2 Accessors
85
86Once created, one can access to the following members of the object:
87
88=over 4
89
90=item $status->audio()
91
92A string with the sample rate of the song currently playing, number of bits
93of the output and number of channels (2 for stereo) - separated by a colon.
94
95
96=item $status->bitrate()
97
98The instantaneous bitrate in kbps.
99
100
101=item $status->error()
102
103May appear in special error cases, such as when disabling output.
104
105
106=item $status->playlist()
107
108The playlist version number, that changes every time the playlist is updated.
109
110
111=item $status->playlistlength()
112
113The number of songs in the playlist.
114
115
116=item $status->random()
117
118Whether the playlist is read randomly or not.
119
120
121=item $status->repeat()
122
123Whether the song is repeated or not.
124
125
126=item $status->song()
127
128The offset of the song currently played in the playlist.
129
130
131=item $status->songid()
132
133The song id (MPD id) of the song currently played.
134
135
136=item $status->state()
137
138The state of MPD server. Either C<play>, C<stop> or C<pause>.
139
140
141=item $status->time()
142
143An C<Audio::MPD::Common::Time> object, representing the time elapsed /
144remainging and total. See the associated pod for more details.
145
146
147=item $status->updating_db()
148
149An integer, representing the current update job.
150
151
152=item $status->volume()
153
154The current MPD volume - an integer between 0 and 100.
155
156
157=item $status->xfade()
158
159The crossfade in seconds.
160
161
162=back
163
164Please note that those accessors are read-only: changing a value will B<not>
165change the current settings of MPD server. Use the mpd modules to alter the
166settings.
167
168
169=head1 SEE ALSO
170
171=over 4
172
173=item L<Audio::MPD>
174
175=item L<POE::Component::Client::MPD>
176
177=back
178
179
180=head1 AUTHOR
181
182Jerome Quelin, C<< <jquelin at cpan.org> >>
183
184
185=head1 COPYRIGHT & LICENSE
186
187Copyright (c) 2007 Jerome Quelin, all rights reserved.
188
189This program is free software; you can redistribute it and/or modify
190it under the same terms as Perl itself.
191
192=cut