pianod2
multisource multiuser scriptable networked music player
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PianodPlaylist Class Referenceabstract

Base class for playlists, but still a MusicThingie. More...

#include <musictypes.h>

Inheritance diagram for PianodPlaylist:
Inheritance graph
[legend]
Collaboration diagram for PianodPlaylist:
Collaboration graph
[legend]

Public Types

enum  PlaylistType { SINGLE , MIX , EVERYTHING , TRANSIENT }
 
- Public Types inherited from MusicThingie
enum class  Type : char {
  Playlist = 'p' , Artist = 'a' , Album = 'l' , Song = 's' ,
  PlaylistSuggestion = 'e' , ArtistSuggestion = 't' , AlbumSuggestion = 'b' , SongSuggestion = 'n' ,
  PlaylistSeed = 'y' , ArtistSeed = 'd' , AlbumSeed = 'u' , SongSeed = 'g' ,
  SongRating = 'i'
}
 
- 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...
 

Public Member Functions

virtual const std::string & playlistId (void) const =0
 Item's playlist ID. More...
 
virtual const std::string id (void) const override
 Primary ID is playlist ID. More...
 
virtual const std::string id (MusicThingie::Type type) const override final
 Return the complete ID when used in a specific context. More...
 
virtual const std::string & internalId (MusicThingie::Type type) const override final
 Return the inner ID when used in a specific context. More...
 
virtual const std::string & name (void) const override final
 Return the most specific name of this, whatever type it is. More...
 
virtual Type type (void) const override
 Return the type letter for a thingie. More...
 
virtual Football::ThingietransmitCommon (Football::Thingie &recipient) const override final
 Typecode for playlist type. More...
 
virtual PianodConnectiontransmitPrivate (PianodConnection &recipient) const override
 Transmit the thingie's user-specific data on a connection. More...
 
class Response assembleRatings (const User *user) const
 
virtual Parsnip::Data serialize () const override final
 Assemble the thingie's data for JSON tranmission. More...
 
virtual void serializePrivate (Parsnip::Data &, const User *user) const override
 Add the thingie's user-specific data for JSON transmission. More...
 
Parsnip::Data serializeRatings (const User *user) const
 
virtual bool matches (const Filter &filter) const override final
 Check if a filter matches this item. More...
 
virtual PianodPlaylistasPlaylist () override final
 
virtual const PianodPlaylistasPlaylist () const override final
 
virtual PlaylistType playlistType (void) const =0
 Mix, everything, transient or single list. More...
 
virtual const std::string & playlistName (void) const =0
 Name of the playlist. More...
 
virtual const std::string & genre (void) const =0
 Get genre of this playlist. More...
 
virtual SongList getRandomSongs (const UserList &users, Media::SelectionMethod selectionMethod)
 Choose some random songs for queueing. More...
 
virtual bool operator== (const std::string &compare) const override
 Check if the primary name of this thingie matches. More...
 
virtual bool operator== (const MusicThingie &compare) const override
 Compare a thingie's name to another of the equivalent or decendent type. More...
 
virtual bool includedInMix (void) const =0
 
virtual void includedInMix (bool include)=0
 
RESPONSE_CODE rate (Rating value, User *user)
 Set a user's playlist's rating. More...
 
Rating rating (const User *user) const
 Retrieve a user's playlist's rating. More...
 
float averageRating () const
 Return the average rating of a playlist, considering all ratings. More...
 
virtual bool canSeed (MusicThingie::Type seedType) const
 Determine if a particular type of seeding is possible. More...
 
virtual bool seed (MusicThingie::Type seedType, const MusicThingie *music) const
 Check if there is a seed of a particular type for this thingie. More...
 
virtual void seed (MusicThingie::Type seedType, MusicThingie *music, bool value)
 Make a particular seed type for this thingie. More...
 
virtual ThingieList getSeeds (void) const
 Get the seed list for a playlist. More...
 
virtual SongList songs () override
 Retrieve a list of requestable songs applicable to this thingie. More...
 
virtual SongList songs (const Filter &filter)
 Get songs belonging to a playlist. More...
 
virtual void updateSelector (const Filter &new_selector)
 Update a playlist's selector algorithm. More...
 
virtual void rename (const std::string &newname)=0
 
virtual void erase ()=0
 
- Public Member Functions inherited from MusicThingie
 MusicThingie (void)
 When allocated, use count starts at 1 and the object is put in the release pool, justifying its existence. More...
 
bool isPrimary (void) const
 
bool isSuggestion (void) const
 
bool isSeed (void) const
 
bool isPlaylist (void) const
 
bool isSong (void) const
 
bool isAlbum (void) const
 
bool isArtist (void) const
 
bool isValidType (void) const
 
Type primaryType (void) const
 
virtual bool canQueue () const
 Indicate if specific item can be queued/requested. More...
 
virtual PianodArtistasArtist ()
 
virtual PianodAlbumasAlbum ()
 
virtual PianodSongasSong ()
 
virtual const PianodArtistasArtist () const
 
virtual const PianodAlbumasAlbum () const
 
virtual const PianodSongasSong () const
 
std::string operator() (void) const
 
void retain (void) const
 Claim an instance. More...
 
void release (void)
 Abandon an instance. More...
 
int getUseCount (void) const
 
virtual OwnershipparentOwner (void) const
 Defer the ownership to the source. More...
 
virtual Media::Source *const source (void) const =0
 MediaSource from which this thingie originates. More...
 
void serializeCommon (Parsnip::Data &) const
 Insert common items into the serialization dictionary. More...
 
bool operator!= (const std::string &compare)
 
bool operator!= (const MusicThingie &compare)
 
- Public Member Functions inherited from SubordinateOwnership
virtual bool isOwnedBy (const User *user) const override
 
virtual bool hasPermission (const User *user, Action action) const override
 
- 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
 

Static Public Member Functions

static Type typetype (void)
 Typecode for playlist objects. More...
 
- Static Public Member Functions inherited from MusicThingie
static std::string TypeName (Type type)
 Get the type name of a music thingie. More...
 
static Type TypeFromName (const std::string &name)
 
static constexpr bool isPrimary (Type t)
 
static constexpr bool isSuggestion (const Type t)
 
static constexpr bool isSeed (const Type t)
 
static constexpr bool isPlaylist (const Type t)
 
static constexpr bool isSong (const Type t)
 
static constexpr bool isAlbum (const Type t)
 
static constexpr bool isArtist (const Type t)
 
static constexpr bool isValidType (const Type t)
 
static Type primaryType (const Type t)
 

Additional Inherited Members

- Protected Member Functions inherited from MusicThingie
virtual ~MusicThingie (void)
 

Detailed Description

Base class for playlists, but still a MusicThingie.

Member Enumeration Documentation

◆ PlaylistType

Enumerator
SINGLE 
MIX 
EVERYTHING 
TRANSIENT 

Member Function Documentation

◆ asPlaylist() [1/2]

virtual const PianodPlaylist* PianodPlaylist::asPlaylist ( ) const
inlinefinaloverridevirtual

Reimplemented from MusicThingie.

◆ asPlaylist() [2/2]

virtual PianodPlaylist* PianodPlaylist::asPlaylist ( )
inlinefinaloverridevirtual

Reimplemented from MusicThingie.

◆ assembleRatings()

Response PianodPlaylist::assembleRatings ( const User user) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ averageRating()

float PianodPlaylist::averageRating ( ) const

Return the average rating of a playlist, considering all ratings.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canSeed()

bool PianodPlaylist::canSeed ( MusicThingie::Type  seedType) const
virtual

Determine if a particular type of seeding is possible.

Parameters
seedTypeThe type of seeding to check for.
Returns
True if that kind of seeding is allowed.

Reimplemented in MusicLibrary::Playlist, and Pandora::Station.

Here is the caller graph for this function:

◆ erase()

virtual void PianodPlaylist::erase ( )
pure virtual

◆ genre()

virtual const std::string& PianodPlaylist::genre ( void  ) const
pure virtual

Get genre of this playlist.

Implemented in MusicLibrary::Playlist, and EncapsulatedPlaylist.

Here is the caller graph for this function:

◆ getRandomSongs()

SongList PianodPlaylist::getRandomSongs ( const UserList users,
Media::SelectionMethod  selectionMethod 
)
virtual

Choose some random songs for queueing.

Because different sources do this differently, it can't be a baseline algorithm; thus it is up to the sources.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSeeds()

ThingieList PianodPlaylist::getSeeds ( void  ) const
virtual

Get the seed list for a playlist.

Reimplemented in MusicLibrary::Playlist, and Pandora::Station.

◆ id() [1/2]

const std::string PianodPlaylist::id ( MusicThingie::Type  type) const
finaloverridevirtual

Return the complete ID when used in a specific context.

Implements MusicThingie.

Here is the call graph for this function:

◆ id() [2/2]

const std::string PianodPlaylist::id ( void  ) const
overridevirtual

Primary ID is playlist ID.

Implements MusicThingie.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ includedInMix() [1/2]

virtual void PianodPlaylist::includedInMix ( bool  include)
pure virtual

◆ includedInMix() [2/2]

virtual bool PianodPlaylist::includedInMix ( void  ) const
pure virtual

◆ internalId()

const std::string & PianodPlaylist::internalId ( MusicThingie::Type  type) const
finaloverridevirtual

Return the inner ID when used in a specific context.

Implements MusicThingie.

Here is the call graph for this function:

◆ matches()

bool PianodPlaylist::matches ( const Filter filter) const
finaloverridevirtual

Check if a filter matches this item.

Implements MusicThingie.

Here is the call graph for this function:

◆ name()

virtual const std::string& PianodPlaylist::name ( void  ) const
inlinefinaloverridevirtual

Return the most specific name of this, whatever type it is.

Implements MusicThingie.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==() [1/2]

bool PianodPlaylist::operator== ( const MusicThingie compare) const
overridevirtual

Compare a thingie's name to another of the equivalent or decendent type.

Returns
Whether primary names are the same. If compared object is not equivalent or decendent, returns false.,

Implements MusicThingie.

Here is the call graph for this function:

◆ operator==() [2/2]

bool PianodPlaylist::operator== ( const std::string &  compare) const
overridevirtual

Check if the primary name of this thingie matches.

If this is an artist, compares to the artist name; if an album, the album name; etc.

Implements MusicThingie.

Here is the call graph for this function:

◆ playlistId()

virtual const std::string& PianodPlaylist::playlistId ( void  ) const
pure virtual

Item's playlist ID.

Implemented in MusicLibrary::Playlist, and EncapsulatedPlaylist.

Here is the caller graph for this function:

◆ playlistName()

virtual const std::string& PianodPlaylist::playlistName ( void  ) const
pure virtual

Name of the playlist.

Implemented in MusicLibrary::Playlist, and EncapsulatedPlaylist.

Here is the caller graph for this function:

◆ playlistType()

virtual PlaylistType PianodPlaylist::playlistType ( void  ) const
pure virtual

Mix, everything, transient or single list.

Implemented in MusicLibrary::Playlist, and EncapsulatedPlaylist.

Here is the caller graph for this function:

◆ rate()

RESPONSE_CODE PianodPlaylist::rate ( Rating  value,
User user 
)

Set a user's playlist's rating.

This is handled internally by pianod.

Parameters
valueThe rating to assign.
userThe user rating the playlist.
Returns
A status code.
Here is the call graph for this function:

◆ rating()

Rating PianodPlaylist::rating ( const User user) const

Retrieve a user's playlist's rating.

Parameters
userThe user to get the rating for.
Returns
A rating code, or Rating::UNRATED.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rename()

virtual void PianodPlaylist::rename ( const std::string &  newname)
pure virtual

◆ seed() [1/2]

bool PianodPlaylist::seed ( MusicThingie::Type  seedType,
const MusicThingie music 
) const
virtual

Check if there is a seed of a particular type for this thingie.

Parameters
seedTypeIndicates artist, album or song seed.
musicThe artist, album or song to use as a seed.

Reimplemented in MusicLibrary::Playlist, and Pandora::Station.

Here is the caller graph for this function:

◆ seed() [2/2]

void PianodPlaylist::seed ( MusicThingie::Type  seedType,
MusicThingie music,
bool  value 
)
virtual

Make a particular seed type for this thingie.

Parameters
seedTypeIndicates artist, album or song seed.
musicThe artist, album or song to use as a seed.
valueWhether to set or remove a seed.

Reimplemented in MusicLibrary::Playlist, and Pandora::Station.

◆ serialize()

Parsnip::Data PianodPlaylist::serialize ( ) const
finaloverridevirtual

Assemble the thingie's data for JSON tranmission.

Implements MusicThingie.

Here is the call graph for this function:

◆ serializePrivate()

void PianodPlaylist::serializePrivate ( Parsnip::Data ,
const User user 
) const
overridevirtual

Add the thingie's user-specific data for JSON transmission.

Implements MusicThingie.

Reimplemented in MusicLibrary::Playlist.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serializeRatings()

Parsnip::Data PianodPlaylist::serializeRatings ( const User user) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ songs() [1/2]

SongList PianodPlaylist::songs ( )
overridevirtual

Retrieve a list of requestable songs applicable to this thingie.

Reimplemented from MusicThingie.

Reimplemented in MusicLibrary::Playlist.

Here is the caller graph for this function:

◆ songs() [2/2]

SongList PianodPlaylist::songs ( const Filter filter)
virtual

Get songs belonging to a playlist.

Parameters
filterMatch only matsongs matching this. If omitted, match all.
Returns
A list of matching songs from the playlist.

Reimplemented in MusicLibrary::Playlist.

◆ transmitCommon()

Football::Thingie & PianodPlaylist::transmitCommon ( Football::Thingie recipient) const
finaloverridevirtual

Typecode for playlist type.

Implements MusicThingie.

Here is the call graph for this function:

◆ transmitPrivate()

PianodConnection & PianodPlaylist::transmitPrivate ( PianodConnection recipient) const
overridevirtual

Transmit the thingie's user-specific data on a connection.

Implements MusicThingie.

Reimplemented in MusicLibrary::Playlist.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

virtual Type PianodPlaylist::type ( void  ) const
inlineoverridevirtual

Return the type letter for a thingie.

This is used as the first letter of the ID, so IDs can be routed to the appropriate dataset/handler.

Implements MusicThingie.

Reimplemented in EncapsulatedPlaylist.

Here is the caller graph for this function:

◆ typetype()

static Type PianodPlaylist::typetype ( void  )
inlinestatic

Typecode for playlist objects.

◆ updateSelector()

void PianodPlaylist::updateSelector ( const Filter new_selector)
virtual

Update a playlist's selector algorithm.

Parameters
new_selectorThe new algorithm.

Reimplemented in MusicLibrary::Playlist.

Here is the caller graph for this function:

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