App-pimpd

 view release on metacpan or  search on metacpan

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

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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.231 second using v1.01-cache-2.11-cpan-55f5a4728d2 )