mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-24 05:03:17 -05:00
[settings] Make settings convenience macros more convenient
This commit is contained in:
parent
f986eedb25
commit
76b5da0f0d
14
src/player.c
14
src/player.c
@ -308,7 +308,6 @@ static int player_flush_pending;
|
|||||||
// Config values and player settings category
|
// Config values and player settings category
|
||||||
static int speaker_autoselect;
|
static int speaker_autoselect;
|
||||||
static int clear_queue_on_stop_disabled;
|
static int clear_queue_on_stop_disabled;
|
||||||
static struct settings_category *player_settings_category;
|
|
||||||
|
|
||||||
// Player status
|
// Player status
|
||||||
static enum play_status player_state;
|
static enum play_status player_state;
|
||||||
@ -3161,7 +3160,7 @@ repeat_set(void *arg, int *retval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Persist
|
// Persist
|
||||||
SETTINGS_SETINT(player_settings_category, PLAYER_SETTINGS_MODE_REPEAT, repeat);
|
SETTINGS_SETINT("player", PLAYER_SETTINGS_MODE_REPEAT, repeat);
|
||||||
|
|
||||||
if (repeat == REPEAT_ALL || repeat == REPEAT_SONG)
|
if (repeat == REPEAT_ALL || repeat == REPEAT_SONG)
|
||||||
{
|
{
|
||||||
@ -3203,7 +3202,7 @@ shuffle_set(void *arg, int *retval)
|
|||||||
shuffle = new_shuffle;
|
shuffle = new_shuffle;
|
||||||
|
|
||||||
// Persist
|
// Persist
|
||||||
SETTINGS_SETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_SHUFFLE, shuffle);
|
SETTINGS_SETBOOL("player", PLAYER_SETTINGS_MODE_SHUFFLE, shuffle);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
*retval = 0;
|
*retval = 0;
|
||||||
@ -3219,7 +3218,7 @@ consume_set(void *arg, int *retval)
|
|||||||
consume = cmdarg->intval;
|
consume = cmdarg->intval;
|
||||||
|
|
||||||
// Persist
|
// Persist
|
||||||
SETTINGS_SETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_CONSUME, consume);
|
SETTINGS_SETBOOL("player", PLAYER_SETTINGS_MODE_CONSUME, consume);
|
||||||
|
|
||||||
if (consume)
|
if (consume)
|
||||||
{
|
{
|
||||||
@ -3879,11 +3878,10 @@ player_init(void)
|
|||||||
clear_queue_on_stop_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable");
|
clear_queue_on_stop_disabled = cfg_getbool(cfg_getsec(cfg, "mpd"), "clear_queue_on_stop_disable");
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_NULL(L_PLAYER, player_settings_category = settings_category_get("player"));
|
ret = SETTINGS_GETINT("player", PLAYER_SETTINGS_MODE_REPEAT);
|
||||||
ret = SETTINGS_GETINT(player_settings_category, PLAYER_SETTINGS_MODE_REPEAT);
|
|
||||||
repeat = (ret > 0) ? ret : REPEAT_OFF;
|
repeat = (ret > 0) ? ret : REPEAT_OFF;
|
||||||
shuffle = SETTINGS_GETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_SHUFFLE);
|
shuffle = SETTINGS_GETBOOL("player", PLAYER_SETTINGS_MODE_SHUFFLE);
|
||||||
consume = SETTINGS_GETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_CONSUME);
|
consume = SETTINGS_GETBOOL("player", PLAYER_SETTINGS_MODE_CONSUME);
|
||||||
|
|
||||||
player_state = PLAY_STOPPED;
|
player_state = PLAY_STOPPED;
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ static struct settings_option misc_options[] =
|
|||||||
{
|
{
|
||||||
{ "streamurl_keywords_artwork_url", SETTINGS_TYPE_STR },
|
{ "streamurl_keywords_artwork_url", SETTINGS_TYPE_STR },
|
||||||
{ "streamurl_keywords_length", SETTINGS_TYPE_STR },
|
{ "streamurl_keywords_length", SETTINGS_TYPE_STR },
|
||||||
|
{ "streamurl_ignore", SETTINGS_TYPE_BOOL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct settings_option player_options[] =
|
static struct settings_option player_options[] =
|
||||||
|
@ -59,9 +59,9 @@ settings_option_getbool(struct settings_option *option);
|
|||||||
char *
|
char *
|
||||||
settings_option_getstr(struct settings_option *option);
|
settings_option_getstr(struct settings_option *option);
|
||||||
|
|
||||||
#define SETTINGS_GETINT(category, name) settings_option_getint(settings_option_get((category), (name)))
|
#define SETTINGS_GETINT(category, name) settings_option_getint(settings_option_get(settings_category_get(category), (name)))
|
||||||
#define SETTINGS_GETBOOL(category, name) settings_option_getbool(settings_option_get((category), (name)))
|
#define SETTINGS_GETBOOL(category, name) settings_option_getbool(settings_option_get(settings_category_get(category), (name)))
|
||||||
#define SETTINGS_GETSTR(category, name) settings_option_getstr(settings_option_get((category), (name)))
|
#define SETTINGS_GETSTR(category, name) settings_option_getstr(settings_option_get(settings_category_get(category), (name)))
|
||||||
|
|
||||||
int
|
int
|
||||||
settings_option_setint(struct settings_option *option, int value);
|
settings_option_setint(struct settings_option *option, int value);
|
||||||
@ -72,9 +72,9 @@ settings_option_setbool(struct settings_option *option, bool value);
|
|||||||
int
|
int
|
||||||
settings_option_setstr(struct settings_option *option, const char *value);
|
settings_option_setstr(struct settings_option *option, const char *value);
|
||||||
|
|
||||||
#define SETTINGS_SETINT(category, name, value) settings_option_setint(settings_option_get((category), (name)), (value))
|
#define SETTINGS_SETINT(category, name, value) settings_option_setint(settings_option_get(settings_category_get(category), (name)), (value))
|
||||||
#define SETTINGS_SETBOOL(category, name, value) settings_option_setbool(settings_option_get((category), (name)), (value))
|
#define SETTINGS_SETBOOL(category, name, value) settings_option_setbool(settings_option_get(settings_category_get(category), (name)), (value))
|
||||||
#define SETTINGS_SETSTR(category, name, value) settings_option_setstr(settings_option_get((category), (name)), (value))
|
#define SETTINGS_SETSTR(category, name, value) settings_option_setstr(settings_option_get(settings_category_get(category), (name)), (value))
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user