Audio-MPD-Common
view release on metacpan or search on metacpan
lib/Audio/MPD/Common/Status.pm view on Meta::CPAN
# -- public attributes
has audio => ( ro, isa=>Str );
has bitrate => ( ro, isa=>Int );
has error => ( ro, isa=>Str );
has playlist => ( ro, isa=>Int );
has playlistlength => ( ro, isa=>Int );
has random => ( ro, isa=>Bool );
has repeat => ( ro, isa=>Bool );
has songid => ( ro, isa=>Int );
has song => ( ro, isa=>Int );
has state => ( ro, isa=>'State' );
has time => ( ro, isa=>'Audio::MPD::Common::Time', coerce );
has updating_db => ( ro, isa=>Int );
has volume => ( ro, isa=>Int );
has xfade => ( ro, isa=>Int, default=>0 );
1;
lib/Audio/MPD/Common/Status.pm view on Meta::CPAN
Whether the playlist is read randomly or not.
=head2 $status->repeat;
Whether the song is repeated or not.
=head2 $status->song;
The offset of the song currently played in the playlist.
=head2 $status->songid;
The song id (MPD id) of the song currently played.
=head2 $status->state;
The state of MPD server. Either C<play>, C<stop> or C<pause>.
=head2 $status->time;
An L<Audio::MPD::Common::Time> object, representing the time elapsed /
my %kv = (
volume => 66,
repeat => 1,
random => 0,
playlist => 24,
playlistlength => 21,
xfade => 14,
state => 'play',
song => 10,
songid => 11,
time => '45:214',
bitrate => 127,
audio => '44100:16:2',
error => 'problems opening audio device',
updating_db => 1,
);
my $s = Audio::MPD::Common::Status->new( \%kv );
isa_ok( $s, 'Audio::MPD::Common::Status', 'object creation' );
isa_ok( $s->time, 'Audio::MPD::Common::Time', 'accessor: time' );
is( $s->volume, 66, 'accessor: volume' );
is( $s->repeat, 1, 'accessor: repeat' );
is( $s->random, 0, 'accessor: random' );
is( $s->playlist, 24, 'accessor: playlist' );
is( $s->playlistlength, 21, 'accessor: playlistlength' );
is( $s->xfade, 14, 'accessor: xfade' );
is( $s->state, 'play', 'accessor: state' );
is( $s->song, 10, 'accessor: song' );
is( $s->songid, 11, 'accessor: songid' );
is( $s->bitrate, 127, 'accessor: bitrate' );
is( $s->audio, '44100:16:2', 'accessor: audio' );
is( $s->error, 'problems opening audio device', 'accessor: error' );
is( $s->updating_db, 1, 'accessor: updating_db' );
( run in 1.463 second using v1.01-cache-2.11-cpan-5735350b133 )