|
pianod2
multisource multiuser scriptable networked music player
|
#include <musiclibrary.h>


Public Types | |
| using | ArtistAllocator = ArtistContainer::Allocator |
| using | AlbumAllocator = AlbumContainer::Allocator |
| using | SongAllocator = SongContainer::Allocator |
| using | PlaylistAllocator = PlaylistContainer::Allocator |
Public Types inherited from MusicLibrary::Foundation | |
| enum | IMPORTANCE { IMPORTANT = 300 , NOMINAL = 1800 , TRIVIAL = 60 * 60 * 6 } |
Public Member Functions | |
| virtual bool | removePlaylist (Playlist *play) override |
| Remove a playlist from the library. More... | |
| virtual ThingieList | seedsForPlaylist (const Playlist *playlist) override |
| Retrieve a list of seeds for a playlist. More... | |
| virtual RetainedList< Song * > | getAllSongs (void) override |
| Get a list of all songs in the library. More... | |
| virtual RetainedList< Song * > | getMatchingSongs (const Filter &criteria) override |
| Get a list of all songs matching a filter. More... | |
| ThingieList | getSuggestions (const Filter &criteria, SearchRange what) |
| Retrieve suggestions from the library. More... | |
| RetainedList< Song * > | getMixSongs (void) |
| Get a list of all songs belonging to enabled playlists. More... | |
| virtual RetainedList< Song * > | getPlaylistSongs (const Playlist *play, bool reassess=false) override |
| Get a list of all songs assigned to a playlist. More... | |
| Playlist * | findPlaylistForSong (Song *song, bool enabled=true) |
| Find a playlist for a song, preferring enabled playlists. More... | |
| virtual void | populatePlaylist (Playlist *play, bool aggressive=false) override |
| Review songs and assign them to a new candidate if they match. More... | |
| void | unpopulatePlaylist (Playlist *play) |
| Reassign all a playlists' songs to some other playlist. More... | |
| void | mixRecalculate (void) |
| Iterate over every song and replace its playlist assignment. More... | |
| MusicThingie * | getById (MusicThingie::Type type, const std::string &id) |
| Retrieve anything stored in the library by its ID. More... | |
| virtual RetainedList< Song * > | getSongsForPlaylist (PianodPlaylist *playlist) override |
| Retrieve all songs for a playlist, which may be a meta playlist. More... | |
| PianodPlaylist * | createPlaylist (const std::string &name, MusicThingie::Type type, MusicThingie *from) |
| Construct a playlist with an initial seed. More... | |
| PianodPlaylist * | createPlaylist (const std::string &name, const Filter &filter) |
| Construct a new smart playlist. More... | |
| PianodPlaylist * | formTransientPlaylist (const Filter &criteria) |
| Construct a temporary playlist. More... | |
| virtual bool | writeIndexToFile (const std::string &filename) const override |
| Persist the library's index into a file. More... | |
| virtual bool | restoreIndexFromFile (const std::string &filename) override |
| Restore the library's index, playlists, seeds and match criteria from a file. More... | |
Public Member Functions inherited from MusicLibrary::Foundation | |
| Foundation (Media::Source *const owner, const bool persistence) | |
| Construct a new media library. More... | |
| void | markDirty (IMPORTANCE import=TRIVIAL) const |
| bool | load () |
| Restore persisted library data from a file. More... | |
| bool | flush () |
| If memory is dirty, write library data to a file. More... | |
| float | periodic () |
| Do intermittent tasks, such as occasionally persisting the catalog to a file. More... | |
| RetainedList< Song * > | getRandomSongs (PianodPlaylist *playlist, const UserList &users, Media::SelectionMethod selectionMethod, const class LibraryParameters &settings) |
| Retrieve some random selections from the library for queue/playback. More... | |
Protected Member Functions | |
| Library (Media::Source *const owner, const bool persistence, const SongAllocator &song_allocator=SongAllocator {song_allocate}, const AlbumAllocator &album_allocator=AlbumAllocator {album_allocate}, const ArtistAllocator &artist_allocator=ArtistAllocator {artist_allocate}, const PlaylistAllocator &playlist_allocator=PlaylistAllocator {playlist_allocate}) | |
| Construct a library. More... | |
| void | purge (void) |
| Remove albums & artists from the library that don't have any songs & albums respectively. More... | |
Protected Member Functions inherited from MusicLibrary::Foundation | |
| virtual void | persist (Parsnip::Data &into) const |
| virtual bool | restore (const Parsnip::Data &data) |
Protected Attributes | |
| ArtistContainer | artists |
| AlbumContainer | albums |
| SongContainer | songs |
| PlaylistContainer | playlists |
Private Types | |
| using | ArtistContainer = ThingieContainer< Artist, Foundation > |
| using | AlbumContainer = ThingieContainer< Album, Artist > |
| using | SongContainer = ThingieContainer< Song, Album > |
| using | PlaylistContainer = ThingieContainer< Playlist, Foundation > |
Additional Inherited Members | |
Public Attributes inherited from MusicLibrary::Foundation | |
| Media::Source *const | source |
|
private |
|
private |
|
private |
|
private |
|
protected |
Construct a library.
| owner | The source to which the media belongs. |
| persistence | If true, library indexes are written to long-term storage. |
| song_allocator | A function constructing songs of the source's type. |
| album_allocator | A function constructing albums of the source's type. |
| artist_allocator | A function constructing artists of the source's type. |
| playlist_allocator | A function constructing playlists of the source's type. |
| PianodPlaylist * MusicLibrary::Library::createPlaylist | ( | const std::string & | name, |
| const Filter & | filter | ||
| ) |
Construct a new smart playlist.
| name | A name for the new playlist. |
| filter | Search criteria with which to construct the playlist. |

| PianodPlaylist * MusicLibrary::Library::createPlaylist | ( | const std::string & | name, |
| MusicThingie::Type | type, | ||
| MusicThingie * | from | ||
| ) |
Construct a playlist with an initial seed.
| name | The name for the new playlist. |
| type | The manner in which to interpret the initial seed. |
| from | An initial seed. |


Find a playlist for a song, preferring enabled playlists.
First, aim for enabled playlists; if not found then recurse and aim for disabled playlists.

| PianodPlaylist * MusicLibrary::Library::formTransientPlaylist | ( | const Filter & | criteria | ) |
Construct a temporary playlist.
| criteria | Search criteria for the temporary playlist. |

|
overridevirtual |
Get a list of all songs in the library.
Implements MusicLibrary::Foundation.


| MusicThingie * MusicLibrary::Library::getById | ( | MusicThingie::Type | type, |
| const std::string & | id | ||
| ) |
Retrieve anything stored in the library by its ID.
| type | The type of the thing. |
| id | The ID of the thing to retrieve. |


|
overridevirtual |
Get a list of all songs matching a filter.
Implements MusicLibrary::Foundation.

| RetainedList< Song * > MusicLibrary::Library::getMixSongs | ( | void | ) |
Get a list of all songs belonging to enabled playlists.


|
overridevirtual |
Get a list of all songs assigned to a playlist.
| play | The playlist for which to retrieve songs. |
| reassess | If false, only assigned songs are returned. If true, songs in other playlists are also considered. |
Implements MusicLibrary::Foundation.

|
overridevirtual |
Retrieve all songs for a playlist, which may be a meta playlist.
Implements MusicLibrary::Foundation.

| ThingieList MusicLibrary::Library::getSuggestions | ( | const Filter & | criteria, |
| SearchRange | what | ||
| ) |
Retrieve suggestions from the library.
This returns a mix of artists, albums, and songs.
| criteria | Specifies the criteria for which to select matching data. |
| what | Describes a search manner.
|


|
inline |
Iterate over every song and replace its playlist assignment.
Applicable on initialization.


|
overridevirtual |
Review songs and assign them to a new candidate if they match.
This is applicable when a playlist has been created or just been added to the mix.
| play | The playlist to populate with songs. |
| aggressive | If true, songs with enabled playlists are considered for reassignment. If false, only songs without a playlist or with a disabled playlist are considered. |
Implements MusicLibrary::Foundation.

|
protected |
Remove albums & artists from the library that don't have any songs & albums respectively.


|
overridevirtual |
Remove a playlist from the library.
| play | The playlist to remove. |
Implements MusicLibrary::Foundation.


|
overridevirtual |
Restore the library's index, playlists, seeds and match criteria from a file.
| filename | The name of the file from which to restore. |
Implements MusicLibrary::Foundation.

|
overridevirtual |
Retrieve a list of seeds for a playlist.
| playlist | The playlist for which to return data. |
Implements MusicLibrary::Foundation.

| void MusicLibrary::Library::unpopulatePlaylist | ( | Playlist * | play | ) |
Reassign all a playlists' songs to some other playlist.
Applicable when song has been removed from the mix, or playlist is about to be deleted.


|
overridevirtual |
Persist the library's index into a file.
This includes playlists and their seeds and match criteria.
| filename | The name of the file. |
Implements MusicLibrary::Foundation.

|
protected |
|
protected |
|
protected |
|
protected |