File Coverage

blib/lib/Audio/MPD/Common/Status.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 31 31 100.0


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