|
pianod2
multisource multiuser scriptable networked music player
|
Tuner maintains a set of playlists and their inclusion or exclusion from the current mix, and can push it to the sources on demand (before getting random songs); this allows multiple mixes to exist. More...
#include <tuner.h>


Classes | |
| struct | Callbacks |
| struct | MixItem |
Public Member Functions | |
| virtual const Parsnip::Parser::Definitions & | getParserDefinitions () override |
| Retrieve the parser definitions handled by the interpreter. More... | |
| Tuner (PianodService *service) | |
| Create a new tuner and load known playlists. More... | |
| ~Tuner () | |
| Destroy the tuner and release resources. More... | |
| void | updatePlaylists () |
| Update the list of playlists known by the tuner. More... | |
| bool | includedInMix (const PianodPlaylist *playlist) |
| Check if a playlist is included in the mix. More... | |
| SongList | getRandomTracks (PianodPlaylist *from, const UserList &users) |
| Acquire some random tracks utilizing the currently-selected randomization mode. More... | |
| void | purge (const Media::Source *const source) |
| Remove a source from the playlist list in preparation for its removal. More... | |
| void | pushPlaylistSelections (Media::Source *const source=nullptr) |
| Push the current playlist selections to the playlists/sources in preparation for getting random songs. More... | |
| bool | recalculatePlaylists () |
| Recalculate the playlists based on current users and autotune settings. More... | |
| bool | empty (const Media::Source *const source) const |
| Check for enabled playlists in the mix. More... | |
| bool | automatic () const |
| void | automatic (bool automatic_playlists) |
| Set or clear automatic playlist selection. More... | |
| UserList | getAutotuneUsers () const |
| Get a list of users to consider for autotuning with the current service and autotuning mode. More... | |
| Response | assembleStatus () const |
| Send current state information. More... | |
Public Member Functions inherited from PianodInterpreter | |
| virtual void | registerInterpreter (PianodDispatcher &dispatcher) |
| Register the interpreter with a dispatcher. More... | |
| const HelpList | getHelp (const std::vector< std::string > &search, std::set< std::string > *option_parsers) |
| Search the interpreter's definitions for any definitions matching search criteria. More... | |
Static Public Member Functions | |
| static UserList | getApplicableUsers (const AutotuneSettings &settings, const PianodService *service) |
| Get a list of users applicable to autotuning. More... | |
Static Public Member Functions inherited from PianodInterpreter | |
| static bool | optionIs (const Parsnip::Data &options, const char *name, const char *expected) |
| Check if a string value exists and is case-blind equal to a particular value. More... | |
| template<typename ValueType , typename LookupType > | |
| static ValueType | optionalValue (const Parsnip::Data &options, const char *name, const LookupType &lookup, const ValueType default_value) |
| Retrieve the ID of a string value. More... | |
Public Attributes | |
| CallbackManager< Tuner, Callbacks > | callback |
Protected Member Functions | |
| PianodPlaylist * | getRandomPlaylist (const PianodPlaylist *criteria) |
| Choose a random playlist (for mixing via playlist). More... | |
Private Types | |
| using | MixMap = std::unordered_map< std::string, MixItem > |
Private Member Functions | |
| virtual bool | authorizedCommand (Parsnip::Parser::CommandId command, PianodConnection &conn) override |
| Check whether a command is authorized. More... | |
| virtual ResponseCollector | handleCommand (Parsnip::Parser::CommandId command, const Parsnip::Data &options, PianodConnection &conn) override |
| Command handler. More... | |
| void | sourcesChanged (const Media::Source *const) |
| Register a new source by adding its playlists to those known. More... | |
Private Attributes | |
| PianodService * | service |
| MixMap | mix |
| bool | automatic_mode = false |
| bool | anyone_listening = false |
| Media::SelectionMethod | random_selection_method = Media::SelectionMethod::Song |
| AutotuneSettings | autotune |
Additional Inherited Members | |
Public Types inherited from PianodInterpreter | |
| using | HelpList = PianodDispatcher::HelpList |
Protected Types inherited from PianodInterpreter | |
| using | StringVector = std::vector< std::string > |
Static Protected Attributes inherited from PianodInterpreter | |
| static const Parsnip::Data | EmptyDictionary {Parsnip::Data::Dictionary} |
| An empty dictionary, often used as a default with Parsnip::Data::getOr. More... | |
| static const StringVector | EmptyStringVector |
| An empty string vector, often used as a default with Parsnip::Data::getOr. More... | |
Tuner maintains a set of playlists and their inclusion or exclusion from the current mix, and can push it to the sources on demand (before getting random songs); this allows multiple mixes to exist.
The tuner also performs autotuning (automatic playlist selection).
|
private |
| Tuner::Tuner::Tuner | ( | PianodService * | svc | ) |
Create a new tuner and load known playlists.
| svc | The service with which the tuner will be associated. |
| Tuner::Tuner::~Tuner | ( | ) |
Destroy the tuner and release resources.
| Response Tuner::Tuner::assembleStatus | ( | ) | const |
Send current state information.

|
overrideprivatevirtual |
Check whether a command is authorized.
| command_id | The command requesting execution. |
| context | Connection details, including authentication state and privileges. |
Implements PianodInterpreter.

|
inline |

| void Tuner::Tuner::automatic | ( | bool | automatic_playlists | ) |
Set or clear automatic playlist selection.
| automatic_playlists | True to enable, false otherwise. |
| bool Tuner::Tuner::empty | ( | const Media::Source *const | source | ) | const |
Check for enabled playlists in the mix.
| source | If not-null, consider only playlists from specified source. |

|
static |
Get a list of users applicable to autotuning.
| settings | The autotuning mode settings. |
| service | The football service to search for user logins. |

| UserList Tuner::Tuner::getAutotuneUsers | ( | ) | const |
Get a list of users to consider for autotuning with the current service and autotuning mode.

|
overridevirtual |
Retrieve the parser definitions handled by the interpreter.
Implements PianodInterpreter.

|
protected |
Choose a random playlist (for mixing via playlist).
| criteria | Specifies which playlists to choose from: which source, and single, mix, everything. |

| SongList Tuner::Tuner::getRandomTracks | ( | PianodPlaylist * | from, |
| const UserList & | users | ||
| ) |
Acquire some random tracks utilizing the currently-selected randomization mode.
| from | A playlist or a metaplaylist from which to choose music. |
| users | The users present, for biasing selections. |


|
overrideprivatevirtual |
Command handler.
| command_id | Command to execute. |
| parameters | Command parameters. |
| context | Connection details, including authentication state and privileges. |
| CommandError | or other exception if an error occurs. |
Implements PianodInterpreter.

| bool Tuner::Tuner::includedInMix | ( | const PianodPlaylist * | playlist | ) |
Check if a playlist is included in the mix.
| playlist | The playlist whose status to check. |


| void Tuner::Tuner::purge | ( | const Media::Source *const | source | ) |
Remove a source from the playlist list in preparation for its removal.
| void Tuner::Tuner::pushPlaylistSelections | ( | Media::Source *const | source = nullptr | ) |
Push the current playlist selections to the playlists/sources in preparation for getting random songs.
| source | If null, pushes all playlists. Otherwise, only pushes those belonging to the source. |
| bool Tuner::Tuner::recalculatePlaylists | ( | ) |
Recalculate the playlists based on current users and autotune settings.


|
private |
Register a new source by adding its playlists to those known.
| void Tuner::Tuner::updatePlaylists | ( | ) |
Update the list of playlists known by the tuner.


|
private |
|
private |
|
private |
| CallbackManager<Tuner, Callbacks> Tuner::Tuner::callback |
|
private |
|
private |
|
private |