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

#include <pandorastation.h>

Inheritance diagram for Pandora::Station:
Inheritance graph
[legend]
Collaboration diagram for Pandora::Station:
Collaboration graph
[legend]

Public Member Functions

 Station (Source *const owner, const Parsnip::Data &message)
 
Stationoperator= (const Station &update)
 This is not a full-copy assignment, this is to update station details in the master when changes are received. More...
 
void forceRefreshDetails ()
 
bool seedAppliesToStation (const MusicThingie *seed) const
 Check if a seed record is applicable to the current station. More...
 
void refreshSeedsAndRatings ()
 Retrieve a station's seed information on file with the servers. More...
 
void takePossession ()
 Convert a shared Pandora station into a private one. More...
 
Source *const pandora () const
 
virtual bool includedInMix (void) const override final
 
virtual void includedInMix (bool include) override final
 
virtual bool canSeed (MusicThingie::Type seedType) const override
 Determine if a particular type of seeding is possible. More...
 
virtual bool seed (MusicThingie::Type seedType, const MusicThingie *music) const override
 Check if there is a seed of a particular type for this thingie. More...
 
virtual void seed (MusicThingie::Type seedType, MusicThingie *music, bool value) override
 Make a particular seed type for this thingie. More...
 
virtual ThingieList getSeeds (void) const override
 Get the seed list for a playlist. More...
 
virtual void rename (const std::string &newname) override
 
virtual void erase () override
 
const std::string & getToken () const
 
- Public Member Functions inherited from EncapsulatedPlaylist
 EncapsulatedPlaylist (Media::Source *const owner, Type type=Type::Playlist)
 
virtual Type type (void) const override
 Return the type letter for a thingie. More...
 
virtual Media::Source *const source (void) const override
 MediaSource from which this thingie originates. More...
 
virtual PlaylistType playlistType (void) const override
 Mix, everything, transient or single list. More...
 
virtual const std::string & playlistId (void) const override
 Item's playlist ID. More...
 
virtual const std::string & playlistName (void) const override
 Name of the playlist. More...
 
virtual const std::string & genre (void) const override
 Get genre of this playlist. More...
 
void playlistType (PlaylistType p)
 
void playlistId (const std::string &p)
 
void playlistId (const char *p)
 
void playlistName (const std::string &n)
 
void playlistName (const char *&n)
 
void genre (const std::string &g)
 
void genre (const char *&g)
 
- Public Member Functions inherited from PianodPlaylist
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 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 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...
 
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 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...
 
- 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...
 
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
 

Public Attributes

SkipTracker skips { 6, 3600 }
 
StationDefinitionDetails< SongRatingfeedback {MusicThingie::Type::Song}
 
StationDefinitionDetails< SongSeedsong_seeds {MusicThingie::Type::Song}
 
StationDefinitionDetails< ArtistSeedartist_seeds {MusicThingie::Type::Artist}
 
StationDefinitionDetails< GenreSeedgenre_seeds {MusicThingie::Type::Playlist}
 

Private Attributes

std::string station_token
 
bool is_shared { false }
 The station is owned by another listener (like a symlink) More...
 
bool may_rename { false }
 The user may rename the station. More...
 
bool in_quick_mix { false }
 The station is participating in the quickmix/shuffle. More...
 
time_t details_expiration = 0
 Time at which seeds expire. More...
 

Friends

class RequestTransformStation
 

Additional Inherited Members

- Public Types inherited from PianodPlaylist
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...
 
- Static Public Member Functions inherited from PianodPlaylist
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)
 
- Protected Member Functions inherited from MusicThingie
virtual ~MusicThingie (void)
 

Constructor & Destructor Documentation

◆ Station()

Pandora::Station::Station ( Source *const  owner,
const Parsnip::Data message 
)
Here is the call graph for this function:

Member Function Documentation

◆ canSeed()

bool Pandora::Station::canSeed ( MusicThingie::Type  seedType) const
overridevirtual

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 from PianodPlaylist.

Here is the caller graph for this function:

◆ erase()

void Pandora::Station::erase ( )
overridevirtual

Implements PianodPlaylist.

Here is the call graph for this function:

◆ forceRefreshDetails()

void Pandora::Station::forceRefreshDetails ( )
Here is the call graph for this function:

◆ getSeeds()

ThingieList Pandora::Station::getSeeds ( void  ) const
overridevirtual

Get the seed list for a playlist.

Reimplemented from PianodPlaylist.

Here is the call graph for this function:

◆ getToken()

const std::string& Pandora::Station::getToken ( ) const
inline
Here is the caller graph for this function:

◆ includedInMix() [1/2]

void Pandora::Station::includedInMix ( bool  include)
finaloverridevirtual

Implements PianodPlaylist.

◆ includedInMix() [2/2]

bool Pandora::Station::includedInMix ( void  ) const
finaloverridevirtual

Implements PianodPlaylist.

◆ operator=()

Station & Pandora::Station::operator= ( const Station update)

This is not a full-copy assignment, this is to update station details in the master when changes are received.

Here is the call graph for this function:

◆ pandora()

Source* const Pandora::Station::pandora ( ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshSeedsAndRatings()

void Pandora::Station::refreshSeedsAndRatings ( )

Retrieve a station's seed information on file with the servers.

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

◆ rename()

void Pandora::Station::rename ( const std::string &  newname)
overridevirtual

Implements PianodPlaylist.

Here is the call graph for this function:

◆ seed() [1/2]

bool Pandora::Station::seed ( MusicThingie::Type  seedType,
const MusicThingie music 
) const
overridevirtual

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 from PianodPlaylist.

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

◆ seed() [2/2]

void Pandora::Station::seed ( MusicThingie::Type  seedType,
MusicThingie music,
bool  value 
)
overridevirtual

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 from PianodPlaylist.

Here is the call graph for this function:

◆ seedAppliesToStation()

bool Pandora::Station::seedAppliesToStation ( const MusicThingie seed) const

Check if a seed record is applicable to the current station.

Parameters
seedThe seed.
Returns
True if the seed is from this station, otherwise false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ takePossession()

void Pandora::Station::takePossession ( )

Convert a shared Pandora station into a private one.

Shared stations cannot be renamed or have their seeds adjusted by the listener.

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

Friends And Related Function Documentation

◆ RequestTransformStation

friend class RequestTransformStation
friend

Member Data Documentation

◆ artist_seeds

◆ details_expiration

time_t Pandora::Station::details_expiration = 0
private

Time at which seeds expire.

◆ feedback

◆ genre_seeds

◆ in_quick_mix

bool Pandora::Station::in_quick_mix { false }
private

The station is participating in the quickmix/shuffle.

◆ is_shared

bool Pandora::Station::is_shared { false }
private

The station is owned by another listener (like a symlink)

◆ may_rename

bool Pandora::Station::may_rename { false }
private

The user may rename the station.

◆ skips

SkipTracker Pandora::Station::skips { 6, 3600 }

◆ song_seeds

◆ station_token

std::string Pandora::Station::station_token
private

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