App-pimpd

 view release on metacpan or  search on metacpan

lib/App/Pimpd/Collection/Search.pm  view on Meta::CPAN

  my $artist  = shift; # Not a regex
  return if !$artist;

  my @tracks = $mpd->collection->songs_by_artist_partial($artist);

  if(!@tracks) {
    return;
  }

  # check if called from the interactive shell
  my $caller_sub = (caller(1))[3];

  if($caller_sub =~ m/App::Pimpd::Shell/) {
    print "$_\n" for map {
      sprintf("%s [%s] %s", $_->artist, $_->album, $_->title);
    } @tracks;
  }

  map{ $_ = $_->file } @tracks;

  return (wantarray()) ? @tracks : scalar(@tracks);

lib/App/Pimpd/Collection/Search.pm  view on Meta::CPAN

sub search_db_title {
  my $title  = shift;
  return if !$title;

  my @titles = $mpd->collection->songs_with_title_partial($title);

  if(!@titles) {
    return;
  }
  # check if called from the interactive shell
  my $caller_sub = (caller(1))[3];

  if($caller_sub =~ m/App::Pimpd::Shell/) {
    print "$_\n" for map {
      sprintf("%s [%s] %s", $_->artist, $_->album, $_->title);
    } @titles;
  }

  map{ $_ = $_->file } @titles;

  return (wantarray()) ? @titles : scalar(@titles);

lib/App/Pimpd/Collection/Search.pm  view on Meta::CPAN

sub search_db_album {
  my $album  = shift;
  return if !$album;
  my @albums = $mpd->collection->songs_from_album_partial($album);

  if(!@albums) {
    return;
  }

  # check if called from the interactive shell
  my $caller_sub = (caller(1))[3];

  if($caller_sub =~ m/App::Pimpd::Shell/) {
    print "$_\n" for map {
      sprintf("%s [%s] %s", $_->artist, $_->album, $_->title);
    } @albums;
  }

  map { $_ = $_->file } @albums;

  return (wantarray()) ? @albums : scalar(@albums);



( run in 0.324 second using v1.01-cache-2.11-cpan-55f5a4728d2 )