[cast] Add option to exclude speakers (closes #659)
This commit is contained in:
parent
275c1cd563
commit
741825d086
|
@ -257,6 +257,14 @@ audio {
|
|||
# password = "s1kr3t"
|
||||
#}
|
||||
|
||||
# Chromecast settings
|
||||
# (make sure you get the capitalization of the device name right)
|
||||
#chromecast "My Chromecast device" {
|
||||
# Enable this option to exclude a particular device from the speaker
|
||||
# list
|
||||
# exclude = false
|
||||
#}
|
||||
|
||||
# Spotify settings (only have effect if Spotify enabled - see README/INSTALL)
|
||||
spotify {
|
||||
# Directory where user settings should be stored (credentials)
|
||||
|
|
|
@ -127,6 +127,13 @@ static cfg_opt_t sec_airplay[] =
|
|||
CFG_END()
|
||||
};
|
||||
|
||||
/* Chromecast device section structure */
|
||||
static cfg_opt_t sec_chromecast[] =
|
||||
{
|
||||
CFG_BOOL("exclude", cfg_false, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
/* FIFO section structure */
|
||||
static cfg_opt_t sec_fifo[] =
|
||||
{
|
||||
|
@ -178,6 +185,7 @@ static cfg_opt_t toplvl_cfg[] =
|
|||
CFG_SEC("library", sec_library, CFGF_NONE),
|
||||
CFG_SEC("audio", sec_audio, CFGF_NONE),
|
||||
CFG_SEC("airplay", sec_airplay, CFGF_MULTI | CFGF_TITLE),
|
||||
CFG_SEC("chromecast", sec_chromecast, CFGF_MULTI | CFGF_TITLE),
|
||||
CFG_SEC("fifo", sec_fifo, CFGF_NONE),
|
||||
CFG_SEC("spotify", sec_spotify, CFGF_NONE),
|
||||
CFG_SEC("sqlite", sec_sqlite, CFGF_NONE),
|
||||
|
|
|
@ -1245,6 +1245,7 @@ cast_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||
{
|
||||
struct output_device *device;
|
||||
const char *friendly_name;
|
||||
cfg_t *chromecast;
|
||||
uint32_t id;
|
||||
|
||||
id = djb_hash(name, strlen(name));
|
||||
|
@ -1260,6 +1261,13 @@ cast_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||
|
||||
DPRINTF(E_DBG, L_CAST, "Event for Chromecast device '%s' (port %d, id %" PRIu32 ")\n", name, port, id);
|
||||
|
||||
chromecast = cfg_gettsec(cfg, "chromecast", name);
|
||||
if (chromecast && cfg_getbool(chromecast, "exclude"))
|
||||
{
|
||||
DPRINTF(E_LOG, L_CAST, "Excluding Chromecast device '%s' as set in config\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
device = calloc(1, sizeof(struct output_device));
|
||||
if (!device)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue