Skip to content

Commit

Permalink
Merge pull request #321 from mang1985/main
Browse files Browse the repository at this point in the history
Single track loop and other things
  • Loading branch information
KoljaWindeler authored Apr 11, 2024
2 parents 20dab78 + 7088ba9 commit dff1148
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 195 deletions.
18 changes: 15 additions & 3 deletions custom_components/ytube_music_player/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,24 @@ async def async_create_form(hass, user_input, page=1):
data_schema[vol.Required(CONF_ADVANCE_CONFIG, default=user_input[CONF_ADVANCE_CONFIG])] = vol.Coerce(bool) # show page 2

elif(page == 3):
data_schema[vol.Optional(CONF_SHUFFLE, default=user_input[CONF_SHUFFLE])] = vol.Coerce(bool) # default duffle, TRUE/FALSE
data_schema[vol.Optional(CONF_LIKE_IN_NAME, default=user_input[CONF_LIKE_IN_NAME])] = vol.Coerce(bool) # default duffle, TRUE/FALSE
data_schema[vol.Optional(CONF_DEBUG_AS_ERROR, default=user_input[CONF_DEBUG_AS_ERROR])] = vol.Coerce(bool) # default duffle, TRUE/FALSE
data_schema[vol.Optional(CONF_SHUFFLE, default=user_input[CONF_SHUFFLE])] = vol.Coerce(bool) # default shuffle, TRUE/FALSE
data_schema[vol.Optional(CONF_SHUFFLE_MODE, default=user_input[CONF_SHUFFLE_MODE])] = selector({ # choose default shuffle mode
"select": {
"options": ALL_SHUFFLE_MODES,
"mode": "dropdown"
}
})
data_schema[vol.Optional(CONF_LIKE_IN_NAME, default=user_input[CONF_LIKE_IN_NAME])] = vol.Coerce(bool) # default like_in_name, TRUE/FALSE
data_schema[vol.Optional(CONF_DEBUG_AS_ERROR, default=user_input[CONF_DEBUG_AS_ERROR])] = vol.Coerce(bool) # debug_as_error, TRUE/FALSE
data_schema[vol.Optional(CONF_LEGACY_RADIO, default=user_input[CONF_LEGACY_RADIO])] = vol.Coerce(bool) # default radio generation typ
data_schema[vol.Optional(CONF_SORT_BROWSER, default=user_input[CONF_SORT_BROWSER])] = vol.Coerce(bool) # sort browser results
data_schema[vol.Optional(CONF_INIT_EXTRA_SENSOR, default=user_input[CONF_INIT_EXTRA_SENSOR])] = vol.Coerce(bool) # default radio generation typ
data_schema[vol.Optional(CONF_INIT_DROPDOWNS,default=user_input[CONF_INIT_DROPDOWNS])] = selector({ # choose dropdown(s)
"select": {
"options": ALL_DROPDOWNS,
"multiple": "true"
}
})
data_schema[vol.Optional(CONF_TRACK_LIMIT, default=user_input[CONF_TRACK_LIMIT])] = vol.Coerce(int)
data_schema[vol.Optional(CONF_MAX_DATARATE, default=user_input[CONF_MAX_DATARATE])] = vol.Coerce(int)
data_schema[vol.Optional(CONF_BRAND_ID, default=user_input[CONF_BRAND_ID])] = str # brand id
Expand Down
10 changes: 8 additions & 2 deletions custom_components/ytube_music_player/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
CONF_LEGACY_RADIO = 'legacy_radio'
CONF_SORT_BROWSER = 'sort_browser'
CONF_INIT_EXTRA_SENSOR = 'extra_sensor'
CONF_INIT_DROPDOWNS = 'dropdowns'
ALL_DROPDOWNS = ["playlists","speakers","playmode","radiomode","repeatmode"]
DEFAULT_INIT_DROPDOWNS = ["playlists","speakers","playmode"]
CONF_MAX_DATARATE = 'max_datarate'

CONF_TRACK_LIMIT = 'track_limit'
Expand All @@ -132,8 +135,6 @@
DEFAULT_MAX_DATARATE = 129000
DEFAULT_LEGACY_RADIO = True
DEFAULT_SORT_BROWSER = True
DEFAULT_SHUFFLE_MODE = 1
DEFAULT_SHUFFLE = True

ERROR_COOKIE = 'ERROR_COOKIE'
ERROR_AUTH_USER = 'ERROR_AUTH_USER'
Expand All @@ -148,6 +149,10 @@
PLAYMODE_SHUFFLE_RANDOM = "Shuffle Random"
PLAYMODE_DIRECT = "Direct"

ALL_SHUFFLE_MODES = [PLAYMODE_SHUFFLE, PLAYMODE_RANDOM, PLAYMODE_SHUFFLE_RANDOM, PLAYMODE_DIRECT]
DEFAULT_SHUFFLE_MODE = PLAYMODE_SHUFFLE_RANDOM
DEFAULT_SHUFFLE = True

SEARCH_ID = "search_id"
SEARCH_TYPE = "search_type"
LIB_PLAYLIST = 'library_playlists'
Expand Down Expand Up @@ -308,6 +313,7 @@ def ensure_config(user_input):
out[CONF_LEGACY_RADIO] = DEFAULT_LEGACY_RADIO
out[CONF_SORT_BROWSER] = DEFAULT_SORT_BROWSER
out[CONF_INIT_EXTRA_SENSOR] = DEFAULT_INIT_EXTRA_SENSOR
out[CONF_INIT_DROPDOWNS] = DEFAULT_INIT_DROPDOWNS
out[CONF_MAX_DATARATE] = DEFAULT_MAX_DATARATE

if user_input is not None:
Expand Down
Loading

0 comments on commit dff1148

Please sign in to comment.