pianod2
multisource multiuser scriptable networked music player
Macros | Typedefs | Enumerations | Functions | Variables
enginecommand.cpp File Reference

Command handlers for audio engine. More...

#include <config.h>
#include <cstdlib>
#include <exception>
#include <memory>
#include <initializer_list>
#include <iomanip>
#include <sstream>
#include <football/football.h>
#include <parsnip/parsnip.h>
#include "fundamentals.h"
#include "lookup.h"
#include "utility.h"
#include "interpreter.h"
#include "engine.h"
#include "predicate.h"
#include "tuner.h"
#include "connection.h"
#include "response.h"
#include "filter.h"
#include "querylist.h"
#include "servicemanager.h"
#include "mediaunit.h"
#include "mediaplayer.h"
#include "mediamanager.h"
#include "audiooptionsparser.h"
Include dependency graph for enginecommand.cpp:

Macros

#define KEY_VERB   "verb"
 
#define KEY_QUEUEMODE   "queueMode"
 
#define KEY_PLAYBACK   "playback"
 
#define KEY_SELECTION   "select"
 
#define SEEDVERB   " <" KEY_VERB ":add|delete|toggle>"
 

Typedefs

typedef enum engine_commands_t ENGINECOMMAND
 Audio engine commands such as start, stop, pause, change playlists or seeds. More...
 

Enumerations

enum  engine_commands_t {
  TIMESTATUS = CMD_RANGE_ENGINE , GETVOLUME , SETVOLUME , GETCROSSFADETIME ,
  SETCROSSFADETIME , GETCROSSFADELEVEL , SETCROSSFADELEVEL , ADJUSTVOLUME ,
  GETHISTORYSIZE , SETHISTORYSIZE , WAITFORENDOFSONG , WAITFORNEXTSONG ,
  QUERYSTATUS , QUERYHISTORY , QUERYQUEUE , NEXTSONG ,
  STOPPLAYBACK , PAUSEPLAYBACK , RESUMEPLAYBACK , TOGGLEPLAYBACK ,
  PLAY , SELECT , PLAYLISTRENAME , PLAYLISTDELETE ,
  PLAYLISTCREATE , PLAYLISTFROMFILTER , PLAYLISTALTERFILTER , GETSUGGESTIONS ,
  LISTSONGSBYFILTER , LISTSONGSBYPLAYLIST , REQUESTMUSIC , REQUESTCLEAR ,
  REQUESTCANCEL , RATE , RATEPLAYLIST , SEEDLIST ,
  SEEDALTER , ALTERAUDIOCONFIG , FILTERECHO
}
 Audio engine commands such as start, stop, pause, change playlists or seeds. More...
 
enum class  SkipManner { NORMAL , ABRUPT }
 
enum class  StopTime { NOW , SONGEND }
 

Functions

template<typename ListType >
ListType AuthorizedUse (const ListType &items_to_check, User *user, CommandReply *diagnostics, Ownership::Action usage)
 Check a list of somethings for authorized use. More...
 
static MusicThingiethingie_cast (MusicThingie *thing, MusicThingie::Type want)
 Validate and/or convert a thingie to a requested type. More...
 
static void seedAction (const CartsVerb action, const ThingieList &seeds, const PlaylistList &targets, const bool fixed_type, MusicThingie::Type seed_type, CommandReply *diagnostics)
 Add, remove, or toggle some seeds to/from some playlists. More...
 

Variables

static const LookupTable< SearchRangeSearchRanges
 
static const LookupTable< SkipMannerSkipManners
 
static const LookupTable< StopTimeStopTimes
 

Detailed Description

Command handlers for audio engine.

Control playback, select music, rate songs and playlists, create/remove playlists and add/remove seeds.

Macro Definition Documentation

◆ KEY_PLAYBACK

#define KEY_PLAYBACK   "playback"

◆ KEY_QUEUEMODE

#define KEY_QUEUEMODE   "queueMode"

◆ KEY_SELECTION

#define KEY_SELECTION   "select"

◆ KEY_VERB

#define KEY_VERB   "verb"

◆ SEEDVERB

#define SEEDVERB   " <" KEY_VERB ":add|delete|toggle>"

Typedef Documentation

◆ ENGINECOMMAND

Audio engine commands such as start, stop, pause, change playlists or seeds.

Enumeration Type Documentation

◆ engine_commands_t

Audio engine commands such as start, stop, pause, change playlists or seeds.

Enumerator
TIMESTATUS 
GETVOLUME 
SETVOLUME 
GETCROSSFADETIME 
SETCROSSFADETIME 
GETCROSSFADELEVEL 
SETCROSSFADELEVEL 
ADJUSTVOLUME 
GETHISTORYSIZE 
SETHISTORYSIZE 
WAITFORENDOFSONG 
WAITFORNEXTSONG 
QUERYSTATUS 
QUERYHISTORY 
QUERYQUEUE 
NEXTSONG 
STOPPLAYBACK 
PAUSEPLAYBACK 
RESUMEPLAYBACK 
TOGGLEPLAYBACK 
PLAY 
SELECT 
PLAYLISTRENAME 
PLAYLISTDELETE 
PLAYLISTCREATE 
PLAYLISTFROMFILTER 
PLAYLISTALTERFILTER 
GETSUGGESTIONS 
LISTSONGSBYFILTER 
LISTSONGSBYPLAYLIST 
REQUESTMUSIC 
REQUESTCLEAR 
REQUESTCANCEL 
RATE 
RATEPLAYLIST 
SEEDLIST 
SEEDALTER 
ALTERAUDIOCONFIG 
FILTERECHO 

◆ SkipManner

enum SkipManner
strong
Enumerator
NORMAL 
ABRUPT 

◆ StopTime

enum StopTime
strong
Enumerator
NOW 
SONGEND 

Function Documentation

◆ AuthorizedUse()

template<typename ListType >
ListType AuthorizedUse ( const ListType &  items_to_check,
User user,
CommandReply diagnostics,
Ownership::Action  usage 
)

Check a list of somethings for authorized use.

Template Parameters
ListTypeThe type of the list.
Parameters
items_to_checkThe list of items.
userThe user requesting authorization.
diagnosticsA diagnostics collector for failed authorizations.
usageThe manner in which the items are to be used.
Returns
A list of somethings for which use is authorized.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ seedAction()

static void seedAction ( const CartsVerb  action,
const ThingieList seeds,
const PlaylistList targets,
const bool  fixed_type,
MusicThingie::Type  seed_type,
CommandReply diagnostics 
)
static

Add, remove, or toggle some seeds to/from some playlists.

Parameters
actionIndicates add, remove or toggle.
seedsThe list of seeds to add/remove.
targetsthe playlists to add/remove from.
fixed_typeIf true, typecast seeds to seed_type when adding/removing.
seed_typeType of seed to typecast to.
diagnosticsStatus aggregator for problems encountered.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ thingie_cast()

static MusicThingie* thingie_cast ( MusicThingie thing,
MusicThingie::Type  want 
)
static

Validate and/or convert a thingie to a requested type.

Parameters
thingThe thing to convert
wantThe type to convert it to.
Returns
A pointer to the object, or nullptr if it does not convert.
Exceptions
CommandErrorWhen converting a song to a playlist, but the song has no playlist.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ SearchRanges

const LookupTable<SearchRange> SearchRanges
static
Initial value:
{ "suggestion", SearchRange::SHALLOW },
{ "request", SearchRange::REQUESTABLE },
{ "known", SearchRange::KNOWN } }
@ SHALLOW
Get matching things, but not their contents.
@ EXHAUSTIVE
Get everything matching, and all their contents.
@ REQUESTABLE
Search requestable sources for matches; return all items matching.
@ KNOWN
Get whatever we know about; don't perform external searches.

◆ SkipManners

const LookupTable<SkipManner> SkipManners
static
Initial value:
{ { "normal", SkipManner::NORMAL },
{ "abrupt", SkipManner::ABRUPT } }

◆ StopTimes

const LookupTable<StopTime> StopTimes
static
Initial value:
{ { "now", StopTime::NOW },
{ "defer", StopTime::SONGEND } }