Skip to content

Commit

Permalink
Merge pull request #385 from emontnemery/dont_break_browsing
Browse files Browse the repository at this point in the history
Don't break media browsing when spotify is not setup
  • Loading branch information
fcusson authored Mar 19, 2023
2 parents 43aa252 + e14359b commit d8816cd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/spotcast/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ async def async_get_media_browser_root_object(
cast_type: str
) -> list[BrowseMedia]:
"""Create a root object for media browsing."""
result = await ha_spotify.async_browse_media(hass, None, None)
try:
result = await ha_spotify.async_browse_media(hass, None, None)
except KeyError:
_LOGGER.debug(
"failed to call spotify.async_browse_media, the Home Assistant spotify "
"integration may not be setup"
)
return []
_LOGGER.debug("async_get_media_browser_root_object return %s", result.children)
return result.children

Expand Down

0 comments on commit d8816cd

Please sign in to comment.