1#
2# This file is part of Audio-MPD-Common
3#
4# This software is copyright (c) 2007 by Jerome Quelin.
5#
6# This is free software; you can redistribute it and/or modify it under
7# the same terms as the Perl 5 programming language system itself.
8#
9use 5.008;
10use strict;
11use warnings;
12
13package Audio::MPD::Common::Status;
14# ABSTRACT: class representing MPD status
15$Audio::MPD::Common::Status::VERSION = '2.003';
16use Moose;
17use MooseX::Has::Sugar;
18use MooseX::Types::Moose qw{ Bool Int Str };
19
20use Audio::MPD::Common::Time;
21use Audio::MPD::Common::Types;
22
23
24# -- public attributes
25
26
27has audio          => ( ro, isa=>Str  );
28has bitrate        => ( ro, isa=>Int  );
29has error          => ( ro, isa=>Str  );
30has playlist       => ( ro, isa=>Int  );
31has playlistlength => ( ro, isa=>Int  );
32has random         => ( ro, isa=>Bool );
33has repeat         => ( ro, isa=>Bool );
34has songid         => ( ro, isa=>Int  );
35has song           => ( ro, isa=>Int  );
36has state          => ( ro, isa=>'State' );
37has time           => ( ro, isa=>'Audio::MPD::Common::Time', coerce );
38has updating_db    => ( ro, isa=>Int  );
39has volume         => ( ro, isa=>Int  );
40has xfade          => ( ro, isa=>Int, default=>0 );
41
42
431;
44
45__END__
46
47=pod
48
49=encoding UTF-8
50
51=head1 NAME
52
53Audio::MPD::Common::Status - class representing MPD status
54
55=head1 VERSION
56
57version 2.003
58
59=head1 DESCRIPTION
60
61The MPD server maintains some information on its current state. Those
62information can be queried with mpd modules. Some of those information
63are served to you as an L<Audio::MPD::Common::Status> object.
64
65An L<Audio::MPD::Common::Status> object does B<not> update itself
66regularly, and thus should be used immediately.
67
68Note: one should B<never> ever instantiate an L<Audio::MPD::Common::Status>
69object directly - use the mpd modules instead.
70
71=head1 ATTRIBUTES
72
73=head2 $status->audio;
74
75A string with the sample rate of the song currently playing, number of
76bits of the output and number of channels (2 for stereo) - separated
77by a colon.
78
79=head2 $status->bitrate;
80
81The instantaneous bitrate in kbps.
82
83=head2 $status->error;
84
85May appear in special error cases, such as when disabling output.
86
87=head2 $status->playlist;
88
89The playlist version number, that changes every time the playlist
90is updated.
91
92=head2 $status->playlistlength;
93
94The number of songs in the playlist.
95
96=head2 $status->random;
97
98Whether the playlist is read randomly or not.
99
100=head2 $status->repeat;
101
102Whether the song is repeated or not.
103
104=head2 $status->song;
105
106The offset of the song currently played in the playlist.
107
108=head2 $status->songid;
109
110The song id (MPD id) of the song currently played.
111
112=head2 $status->state;
113
114The state of MPD server. Either C<play>, C<stop> or C<pause>.
115
116=head2 $status->time;
117
118An L<Audio::MPD::Common::Time> object, representing the time elapsed /
119remainging and total. See the associated pod for more details.
120
121=head2 $status->updating_db;
122
123An integer, representing the current update job.
124
125=head2 $status->volume;
126
127The current MPD volume - an integer between 0 and 100.
128
129=head2 $status->xfade;
130
131The crossfade in seconds.
132
133=head1 AUTHOR
134
135Jerome Quelin
136
137=head1 COPYRIGHT AND LICENSE
138
139This software is copyright (c) 2007 by Jerome Quelin.
140
141This is free software; you can redistribute it and/or modify it under
142the same terms as the Perl 5 programming language system itself.
143
144=cut
145