Skip to content

Commit

Permalink
Fix issues with the option flow after upgrading the component.
Browse files Browse the repository at this point in the history
  • Loading branch information
mang1985 committed Apr 12, 2024
1 parent 413fe5e commit 463a977
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/ytube_music_player/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,15 @@ def ensure_config(user_input):
out[CONF_MAX_DATARATE] = DEFAULT_MAX_DATARATE

if user_input is not None:
# for the old shuffle_mode setting.
out.update(user_input)

if isinstance(_shuffle_mode := out[CONF_SHUFFLE_MODE], int):
if _shuffle_mode >= 1:
out[CONF_SHUFFLE_MODE] = ALL_SHUFFLE_MODES[_shuffle_mode - 1]
else:
out[CONF_SHUFFLE_MODE] = PLAYMODE_DIRECT
_LOGGER.error(f"shuffle_mode: {_shuffle_mode} is a deprecated value and has been replaced with '{out[CONF_SHUFFLE_MODE]}'.")

return out


Expand Down

0 comments on commit 463a977

Please sign in to comment.