Merge pull request #1484 from chme/fix/consume-repeat

[player] Turn repeat mode off when activating consume mode
This commit is contained in:
Christian Meffert 2022-06-03 07:51:37 +02:00 committed by GitHub
commit ffcde46140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2975,10 +2975,14 @@ volume_generic_bh(void *arg, int *retval)
return COMMAND_END;
}
static enum command_state
consume_set(void *arg, int *retval);
static enum command_state
repeat_set(void *arg, int *retval)
{
enum repeat_mode *mode = arg;
union player_arg consume_arg;
if (*mode == repeat)
{
@ -3003,6 +3007,13 @@ repeat_set(void *arg, int *retval)
// Persist
SETTINGS_SETINT(player_settings_category, PLAYER_SETTINGS_MODE_REPEAT, repeat);
if (repeat == REPEAT_ALL || repeat == REPEAT_SONG)
{
// Activating repeat requires repeat consume mode to be off
consume_arg.intval = 0;
consume_set(&consume_arg, retval);
}
*retval = 0;
return COMMAND_END;
}
@ -3046,6 +3057,7 @@ shuffle_set(void *arg, int *retval)
static enum command_state
consume_set(void *arg, int *retval)
{
enum repeat_mode repeat_mode;
union player_arg *cmdarg = arg;
consume = cmdarg->intval;
@ -3053,6 +3065,13 @@ consume_set(void *arg, int *retval)
// Persist
SETTINGS_SETBOOL(player_settings_category, PLAYER_SETTINGS_MODE_CONSUME, consume);
if (consume)
{
// Activating cosume mode requires repeat mode to be off
repeat_mode = REPEAT_OFF;
repeat_set(&repeat_mode, retval);
}
*retval = 0;
return COMMAND_END;
}