pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Private Attributes | Friends | List of all members
Filesystem::Source Class Reference

Source for filesystem media. More...

#include <filesystem.h>

Inheritance diagram for Filesystem::Source:
Inheritance graph
[legend]
Collaboration diagram for Filesystem::Source:
Collaboration graph
[legend]

Public Member Functions

 Source (const Parameters &params)
 
 ~Source (void)
 Destroy a source. More...
 
virtual const char * kind (void) const override
 A unique string identifying the type of source. More...
 
virtual bool canExpandToAllSongs (void) const override
 Indicate if arbitrary tracks can be requested from this source. More...
 
virtual bool flush (void) override
 Persist data for a source. More...
 
virtual float periodic (void) override
 Do intermittent or background tasks. More...
 
virtual PlaylistList getPlaylists (const Filter &filter=Filter::All) override
 Retrieve the source's playlists. More...
 
virtual MusicThingiegetAnythingById (const Media::SplitId &id) override
 
virtual PianodPlaylistgetMixPlaylist (void) override
 
virtual PianodPlaylistgetEverythingPlaylist (void) override
 
virtual PianodPlaylistcreatePlaylist (const char *name, MusicThingie::Type type, MusicThingie *from) override
 Create a playlist using a thingie as an initial seed. More...
 
virtual PianodPlaylistcreatePlaylist (const char *name, const Filter &filter) override
 Create a playlist using a filter. More...
 
virtual PianodPlaylistgetTransientPlaylist (const Filter &criteria) override
 Create a temporary playlist based on a filter. More...
 
virtual Media::PlayergetPlayer (const AudioSettings &audio, PianodSong *song) override
 
virtual SongList getRandomSongs (PianodPlaylist *playlist, const UserList &users, Media::SelectionMethod selectionMethod) override
 
virtual ThingieList getSuggestions (const Filter &filter, SearchRange where) override
 
virtual void playbackProblem (void) override
 
virtual MusicThingiegetSuggestion (MusicThingie *thing, MusicThingie::Type type, SearchRange where) override
 Retrieve an equivalent or related album, artist, or song from a source. More...
 
void rescan (bool reset)
 
- Public Member Functions inherited from Media::Source
 Source (SourceParameters *params)
 Initialize the source. More...
 
void persist (void) const
 Persist source parameters, attaching them to the owner's user data. More...
 
bool isReady (void) const
 Check if the source is online. More...
 
SerialNumber serialNumber (void) const
 Get the source's unique number assigned by the media manager. More...
 
const StatisticsgetStatistics () const
 Retrieve playback statistics about the source. More...
 
const bool isLockedOut () const
 Check if source is temporarily locked out due to repeated failures. More...
 
Parsnip::Data serializeIdentity () const
 
std::string identify () const
 Identify the unique source. More...
 
void alert (RESPONSE_CODE message) const
 Send an alert notification regarding this source. More...
 
void alert (RESPONSE_CODE message, const char *detail, const char *reason=nullptr) const
 Send an alert notification regarding this source. More...
 
void reportStatus (const char *detail) const
 Send a status notification regarding this source. More...
 
void reportStatus (const std::string &detail) const
 
const std::string & name (void) const
 Get the name of this source. More...
 
std::string key (void) const
 Key is a combination of kind and name. More...
 
std::string filename (void) const
 Provide a filename for persisting the source's data. More...
 
virtual bool requireNameForCreatePlaylist (void) const
 Indicate if a name is required when creating a playlist. More...
 
PianodPlaylistgetPlaylistByName (const char *name)
 Retrieve a playlist by name. More...
 
void playbackComplete (bool played, bool successfully)
 Update playback statistics. More...
 
MusicThingiegetSuggestion (MusicThingie *thing, SearchRange where=SearchRange::SHALLOW)
 Retrieve an equivalent album, artist, or song from a source. More...
 
- Public Member Functions inherited from PrimaryOwnership
 PrimaryOwnership (void)
 Default construct ownership: No owner, private access. More...
 
 PrimaryOwnership (Type rule, User *owner=nullptr)
 Construct ownership. More...
 
 ~PrimaryOwnership (void)
 
void abandon (void)
 Disassociate ownership from any owner, and mark as disowned. More...
 
void abandon (const User *user)
 Conditionally dissociate ownership. More...
 
UsergetOwner (void) const
 
bool isOwned (void) const
 
const std::string & ownerName (void) const
 Retrieve the name of the owner. More...
 
virtual bool isOwnedBy (const User *user) const override
 Check if we are owned by a user. More...
 
virtual bool hasPermission (const User *user, Action action) const override
 Determine if a user has permission to use this item in some manner. More...
 
- Public Member Functions inherited from Ownership
bool isVisibleBy (const User *user) const
 
bool isUsableBy (const User *user) const
 
bool isDecendableBy (const User *user) const
 
bool isReadableBy (const User *user) const
 
bool isEditableBy (const User *user) const
 

Private Attributes

Library library
 
PianodPlaylistmix_playlist = nullptr
 
PianodPlaylisteverything_playlist = nullptr
 

Friends

class Playlist
 

Additional Inherited Members

- Public Types inherited from Media::Source
typedef unsigned long SerialNumber
 
- Public Types inherited from Ownership
enum class  Type {
  DISOWNED , PRIVATE , SHARED , PUBLISHED ,
  PUBLIC
}
 Access levels for an object. More...
 
enum class  Action { SEE , USE , READ , ALTER }
 Access actions for an object. More...
 
- Protected Types inherited from Media::Source
enum class  State { INITIALIZING , VALID , READY , DEAD }
 
- Protected Member Functions inherited from Media::Source
MusicThingiegetSuggestion (MusicThingie *thing, MusicThingie::Type type, SearchRange where, bool fully_confirm)
 Get a thing as a suggestion of a specific type. More...
 
- Protected Attributes inherited from Media::Source
State state = State::INITIALIZING
 
const SourceParametersparameters = nullptr
 Configuration details for this source, provided on source creation. More...
 

Detailed Description

Source for filesystem media.

Constructor & Destructor Documentation

◆ Source()

Filesystem::Source::Source ( const Parameters params)
Here is the call graph for this function:

◆ ~Source()

Filesystem::Source::~Source ( void  )
virtual

Destroy a source.

Reimplemented from Media::Source.

Here is the call graph for this function:

Member Function Documentation

◆ canExpandToAllSongs()

bool Filesystem::Source::canExpandToAllSongs ( void  ) const
overridevirtual

Indicate if arbitrary tracks can be requested from this source.

Returns
True if requests are allowed, false otherwise.

Reimplemented from Media::Source.

◆ createPlaylist() [1/2]

PianodPlaylist * Filesystem::Source::createPlaylist ( const char *  name,
const Filter filter 
)
overridevirtual

Create a playlist using a filter.

Parameters
nameThe name of the playlist
filterThe selection criteria.
Returns
The playlist created.
Exceptions
CommandErrorif a request is invalid.

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ createPlaylist() [2/2]

PianodPlaylist * Filesystem::Source::createPlaylist ( const char *  name,
MusicThingie::Type  type,
MusicThingie from 
)
overridevirtual

Create a playlist using a thingie as an initial seed.

Seed type allows, for example, to use a song's artist.

Parameters
nameThe name of the playlist.
typeThe type of seed to create.
fromThe initial seed.
Returns
The playlist created.
Exceptions
CommandErrorif a request is invalid.

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ flush()

bool Filesystem::Source::flush ( void  )
overridevirtual

Persist data for a source.

Returns
True on success, false on error.

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ getAnythingById()

MusicThingie * Filesystem::Source::getAnythingById ( const Media::SplitId id)
overridevirtual

Implements Media::Source.

Here is the call graph for this function:

◆ getEverythingPlaylist()

PianodPlaylist * Filesystem::Source::getEverythingPlaylist ( void  )
overridevirtual

Implements Media::Source.

◆ getMixPlaylist()

PianodPlaylist * Filesystem::Source::getMixPlaylist ( void  )
overridevirtual

Implements Media::Source.

◆ getPlayer()

Media::Player * Filesystem::Source::getPlayer ( const AudioSettings audio,
PianodSong song 
)
overridevirtual

Implements Media::Source.

Here is the call graph for this function:

◆ getPlaylists()

PlaylistList Filesystem::Source::getPlaylists ( const Filter filter = Filter::All)
overridevirtual

Retrieve the source's playlists.

Parameters
filterCriteria specifying the subset of the playlists to retrieve.
Returns
Playlists matching the filter, or all playlists if omitted.

Implements Media::Source.

Here is the call graph for this function:

◆ getRandomSongs()

SongList Filesystem::Source::getRandomSongs ( PianodPlaylist playlist,
const UserList users,
Media::SelectionMethod  selectionMethod 
)
overridevirtual

Implements Media::Source.

Here is the call graph for this function:

◆ getSuggestion()

MusicThingie * Filesystem::Source::getSuggestion ( MusicThingie thing,
MusicThingie::Type  type,
SearchRange  where 
)
overridevirtual

Retrieve an equivalent or related album, artist, or song from a source.

To support pianod's engine, this converts items between sources. The engine should not be asking for type conversions within a source.

Parameters
thingThe item to match.
typeThe desired type to find.
whereSelects the depth/exhaustiveness of search.
Returns
The single, best-matching item.
Exceptions
CommandErrorwith:
  • E_INVALID (inadequate criteria)
  • E_AMBIGUOUS (multiple matches)
  • E_NOTFOUND.

Implements Media::Source.

Here is the call graph for this function:

◆ getSuggestions()

ThingieList Filesystem::Source::getSuggestions ( const Filter filter,
SearchRange  where 
)
overridevirtual

Implements Media::Source.

Here is the call graph for this function:

◆ getTransientPlaylist()

PianodPlaylist * Filesystem::Source::getTransientPlaylist ( const Filter criteria)
overridevirtual

Create a temporary playlist based on a filter.

Parameters
criteriaA filter specifying the song selection algorithm.
Returns
A temporary playlist, or nullptr if not viable for some reaon.
Exceptions
E_MEDIA_ACTIONif a non-request source.

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ kind()

const char * Filesystem::Source::kind ( void  ) const
overridevirtual

A unique string identifying the type of source.

Implements Media::Source.

◆ periodic()

float Filesystem::Source::periodic ( void  )
overridevirtual

Do intermittent or background tasks.

Returns
Suggested time before periodic() be invoked again. No guarantees are offered about actual behavior.

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ playbackProblem()

void Filesystem::Source::playbackProblem ( void  )
overridevirtual

Reimplemented from Media::Source.

Here is the call graph for this function:

◆ rescan()

void Filesystem::Source::rescan ( bool  reset)
Here is the call graph for this function:

Friends And Related Function Documentation

◆ Playlist

friend class Playlist
friend

Member Data Documentation

◆ everything_playlist

PianodPlaylist* Filesystem::Source::everything_playlist = nullptr
private

◆ library

Library Filesystem::Source::library
private

◆ mix_playlist

PianodPlaylist* Filesystem::Source::mix_playlist = nullptr
private

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