pianod2
multisource multiuser scriptable networked music player
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
MusicLibrary::Foundation Class Referenceabstract

#include <musiclibrary.h>

Inheritance diagram for MusicLibrary::Foundation:
Inheritance graph
[legend]
Collaboration diagram for MusicLibrary::Foundation:
Collaboration graph
[legend]

Public Types

enum  IMPORTANCE { IMPORTANT = 300 , NOMINAL = 1800 , TRIVIAL = 60 * 60 * 6 }
 

Public Member Functions

 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...
 
virtual RetainedList< Song * > getAllSongs (void)=0
 
virtual RetainedList< Song * > getMatchingSongs (const Filter &criteria)=0
 
virtual bool removePlaylist (Playlist *play)=0
 
virtual ThingieList seedsForPlaylist (const Playlist *playlist)=0
 
virtual void populatePlaylist (Playlist *play, bool aggressive=false)=0
 
virtual RetainedList< Song * > getSongsForPlaylist (PianodPlaylist *)=0
 
virtual RetainedList< Song * > getPlaylistSongs (const Playlist *play, bool reassess=false)=0
 
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...
 

Public Attributes

Media::Source *const source
 

Protected Member Functions

virtual bool restoreIndexFromFile (const std::string &filename)=0
 
virtual bool writeIndexToFile (const std::string &filename) const =0
 
virtual void persist (Parsnip::Data &into) const
 
virtual bool restore (const Parsnip::Data &data)
 

Private Attributes

const bool persist_data {false}
 
time_t write_time {0}
 

Member Enumeration Documentation

◆ IMPORTANCE

Enumerator
IMPORTANT 
NOMINAL 
TRIVIAL 

Constructor & Destructor Documentation

◆ Foundation()

MusicLibrary::Foundation::Foundation ( Media::Source *const  owner,
const bool  persistence 
)

Construct a new media library.

Parameters
ownerThe source to which the library belongs.
persistenceIf true, library indexes are written to long-term storage.

Member Function Documentation

◆ flush()

bool MusicLibrary::Foundation::flush ( void  )

If memory is dirty, write library data to a file.

Returns
True on success, false on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllSongs()

virtual RetainedList<Song *> MusicLibrary::Foundation::getAllSongs ( void  )
pure virtual

Implemented in MusicLibrary::Library.

◆ getMatchingSongs()

virtual RetainedList<Song *> MusicLibrary::Foundation::getMatchingSongs ( const Filter criteria)
pure virtual

Implemented in MusicLibrary::Library.

◆ getPlaylistSongs()

virtual RetainedList<Song *> MusicLibrary::Foundation::getPlaylistSongs ( const Playlist play,
bool  reassess = false 
)
pure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

◆ getRandomSongs()

RetainedList< Song * > MusicLibrary::Foundation::getRandomSongs ( PianodPlaylist playlist,
const UserList users,
Media::SelectionMethod  selectionMethod,
const class LibraryParameters settings 
)

Retrieve some random selections from the library for queue/playback.

Parameters
playlistThe playlist selections should be from.
usersUsers to consider when making selections.
selectionMethodManner in which to pick selections.
settingsBiasing parameters.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSongsForPlaylist()

virtual RetainedList<Song *> MusicLibrary::Foundation::getSongsForPlaylist ( PianodPlaylist )
pure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

◆ load()

bool MusicLibrary::Foundation::load ( )

Restore persisted library data from a file.

Returns
True on success, false on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ markDirty()

void MusicLibrary::Foundation::markDirty ( IMPORTANCE  import = TRIVIAL) const
inline
Here is the caller graph for this function:

◆ periodic()

float MusicLibrary::Foundation::periodic ( void  )

Do intermittent tasks, such as occasionally persisting the catalog to a file.

Returns
Interval until function wants to be called again.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ persist()

virtual void MusicLibrary::Foundation::persist ( Parsnip::Data into) const
inlineprotectedvirtual

Reimplemented in Filesystem::Library.

Here is the caller graph for this function:

◆ populatePlaylist()

virtual void MusicLibrary::Foundation::populatePlaylist ( Playlist play,
bool  aggressive = false 
)
pure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

◆ removePlaylist()

virtual bool MusicLibrary::Foundation::removePlaylist ( Playlist play)
pure virtual

Implemented in MusicLibrary::Library.

◆ restore()

virtual bool MusicLibrary::Foundation::restore ( const Parsnip::Data data)
inlineprotectedvirtual

Reimplemented in Filesystem::Library.

◆ restoreIndexFromFile()

virtual bool MusicLibrary::Foundation::restoreIndexFromFile ( const std::string &  filename)
protectedpure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

◆ seedsForPlaylist()

virtual ThingieList MusicLibrary::Foundation::seedsForPlaylist ( const Playlist playlist)
pure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

◆ writeIndexToFile()

virtual bool MusicLibrary::Foundation::writeIndexToFile ( const std::string &  filename) const
protectedpure virtual

Implemented in MusicLibrary::Library.

Here is the caller graph for this function:

Member Data Documentation

◆ persist_data

const bool MusicLibrary::Foundation::persist_data {false}
private

◆ source

Media::Source* const MusicLibrary::Foundation::source

◆ write_time

time_t MusicLibrary::Foundation::write_time {0}
mutableprivate

The documentation for this class was generated from the following files: