AnyEvent-Net-MPD

 view release on metacpan or  search on metacpan

t/example/endless.pl  view on Meta::CPAN

# Log::Any::Adapter->set('Stderr');

my $total_length = 21;
my $n = 1;
my $previous = -1;

my $idle; $idle = sub {
  $mpd->send( 'status', sub {
    my $status = shift->recv;

    my $current = $status->{songid};
    if ($current ne $previous) {
      $previous = $current;

      $mpd->send( 'playlist', sub {
        my @playlist = @{shift->recv};

        # I wish there was a smarter way
        $mpd->send( { parser => 'none' }, 'list_all', sub {
          my @files =
            map { (split /:\s+/, $_, 2)[1] }



( run in 0.410 second using v1.01-cache-2.11-cpan-ceb78f64989 )