Permalink
Browse files

collection: new methods all_genres / artists_by_genre (sebastien nobili)

  • Loading branch information...
jquelin committed Sep 24, 2011
1 parent db63e1a commit 6f3380a320ef105db4e7a13239c429ef424da3ac
Showing with 33 additions and 2 deletions.
  1. +2 −0 Changes
  2. +30 −1 lib/Audio/MPD/Collection.pm
  3. +1 −1 weaver.ini
View
@@ -1,6 +1,8 @@
Changelog for Audio-MPD
{{$NEXT}}
+ - collection: new method all_genres (sebastien nobili)
+ - collection: new method artists_by_genre (sebastien nobili)
1.111200 2011-04-30 10:21:31 Europe/Paris
- removing misleading example in pod
@@ -191,6 +191,20 @@ sub all_playlists {
}
+=meth_coll_whole all_genres
+
+ my @genres = $coll->all_genres;
+
+Return the list of all genres (strings) currently known by mpd.
+
+=cut
+
+sub all_genres {
+ my ($self) = @_;
+ return $self->_mpd->_cooked_command_strip_first_field( "list genre\n" );
+}
+
+
# -- Collection: picking songs
=meth_coll_pick song
@@ -227,7 +241,7 @@ sub songs_with_filename_partial {
}
-# -- Collection: songs, albums & artists relations
+# -- Collection: songs, albums, artists & genres relations
=meth_coll_relations albums_by_artist
@@ -344,6 +358,21 @@ sub songs_with_title_partial {
}
+=meth_coll_relations artists_by_genre
+
+ my @artists = $coll->artists_by_genre( $genre );
+
+Return all artists (strings) of C<$genre>.
+
+=cut
+
+sub artists_by_genre {
+ my ($self, $genre) = @_;
+ $genre =~ s/"/\\"/g;
+ return $self->_mpd->_cooked_command_strip_first_field( qq[list artist genre "$genre"\n] );
+}
+
+
no Moose;
__PACKAGE__->meta->make_immutable;
1;
View
@@ -44,7 +44,7 @@ command = meth_coll_pick
header = PICKING A SONG
[Collect / COLL_RELATIONS]
command = meth_coll_relations
-header = SONGS, ALBUMS & ARTISTS RELATIONS
+header = SONGS, ALBUMS, ARTISTS & GENRES RELATIONS
; audio::mpd::playlist
[Collect / PLAY_INFO]

0 comments on commit 6f3380a

Please sign in to comment.