Audio:...ection(3pm)

πŸ“¦
version 2.004 Β· 2 versions
  • 2.004 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 2.004 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… NAME

Audio::MPD::Collection β€” a whole class whose entire job is to query MPD's collection, and it's so good at it. (This page lives in the User Contributed Perl Documentation, iykyk.)

🌸 VERSION

version 2.004 β€” yeah bestie, we're on 2.004.

✨ SYNOPSIS

my @songs = $mpd->collection->all_songs;
# and lots of other methods

πŸ¦‹ DESCRIPTION

Audio::MPD::Collection is a class that exists to access & query MPD's collection. The whole point is that you get to use these high-level methods instead of the low-level ones that mpd itself hands you. It's giving "let me handle the messy parts, you just vibe."

Okay but real talk β€” you are NOT supposed to call the constructor yourself. An Audio::MPD::Collection gets created for you automatically while an Audio::MPD object is being created, and then you reach it through the collection() accessor. That's the move. πŸ™ˆ


πŸŽ€ RETRIEVING SONGS & DIRECTORIES

all_items

my @items = $coll->all_items( [$path] );

Returns every Audio::MPD::Common::Items (songs and directories, both of them) that mpd currently knows about.

If you pass $path (relative to mpd root), it restricts the retrieval to just the songs and dirs in that directory.

all_items_simple

my @items = $coll->all_items_simple( [$path] );

Returns every Audio::MPD::Common::Items (songs and directories) that mpd currently knows about.

If you pass $path (relative to mpd root), it restricts the retrieval to just the songs and dirs in that directory.

/!\ Warning: the Audio::MPD::Common::Item::Song objects you get back will only have their file tag filled. Every other tag will be empty, so do not use this sub for anything other than a quick scan! Like, nothing else. Fr fr. 😭

items_in_dir

my @items = $coll->items_in_dir( [$path] );

Returns the items in the given $path. If you don't supply a $path, it does the thing on mpd's root directory.

Heads up: this sub does not work recusrively over all directories. (That spelling is the original's, bestie, I'm just the messenger 🫢)


πŸ‘‘ RETRIEVING THE WHOLE COLLECTION

all_songs

my @songs = $coll->all_songs( [$path] );

Returns all Audio::MPD::Common::Item::Songs that mpd currently knows about.

If you pass $path (relative to mpd root), it restricts the retrieval to the songs and dirs in that directory.

all_albums

my @albums = $coll->all_albums;

Returns the list of all albums (as strings) that mpd currently knows about.

all_artists

my @artists = $coll->all_artists;

Returns the list of all artists (as strings) that mpd currently knows about.

all_titles

my @titles = $coll->all_titles;

Returns the list of all song titles (as strings) that mpd currently knows about.

all_pathes

my @pathes = $coll->all_pathes;

Returns the list of all pathes (as strings) that mpd currently knows about.

all_playlists

my @lists = $coll->all_playlists;

Returns the list of all playlists (as strings) that mpd currently knows about.

all_genres

my @genres = $coll->all_genres;

Returns the list of all genres (as strings) that mpd currently knows about.


πŸ“ PICKING A SONG

song

my $song = $coll->song( $path );

Returns the Audio::MPD::Common::Item::Song that corresponds to $path. One path in, one song out. Slay. πŸ’…

songs_with_filename_partial

my @songs = $coll->songs_with_filename_partial( $string );

Returns all the Audio::MPD::Common::Item::Songs that contain $string somewhere in their path.


🌈 SONGS, ALBUMS, ARTISTS & GENRES RELATIONS

albums_by_artist

my @albums = $coll->albums_by_artist( $artist );

Returns all albums (as strings) performed by $artist, or where $artist participated at all.

songs_by_artist

my @songs = $coll->songs_by_artist( $artist );

Returns all Audio::MPD::Common::Item::Songs performed by $artist.

songs_by_artist_partial

my @songs = $coll->songs_by_artist_partial( $string );

Returns all Audio::MPD::Common::Item::Songs performed by an artist who has $string in her name.

songs_from_album

my @songs = $coll->songs_from_album( $album );

Returns all Audio::MPD::Common::Item::Songs appearing in $album.

songs_from_album_partial

my @songs = $coll->songs_from_album_partial( $string );

Returns all Audio::MPD::Common::Item::Songs appearing in an album that contains $string.

songs_with_title

my @songs = $coll->songs_with_title( $title );

Returns all Audio::MPD::Common::Item::Songs whose title is exactly $title. Exact match only, no improvising. ✨

songs_with_title_partial

my @songs = $coll->songs_with_title_partial( $string );

Returns all Audio::MPD::Common::Item::Songs where $string is part of the title.

artists_by_genre

my @artists = $coll->artists_by_genre( $genre );

Returns all artists (as strings) of $genre.


πŸ’œ AUTHOR

Jerome Quelin

This software is copyright (c) 2007 by Jerome Quelin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


okay that's the whole page, bestie β€” no cap, every single method accounted for πŸŽ€βœ¨

This was perl v5.34.0, dated 2022-06-08, living under Audio:...ection(3pm) in the User Contributed Perl Documentation. Go forth and query your collection, main character. πŸ’–πŸ‘‘

πŸ“¦ where this page comes from