Adjust Sonos for updated Spotify media browsing (#66508)

This commit is contained in:
Erik Montnemery 2022-02-14 20:15:09 +01:00 committed by GitHub
parent 09e59e5887
commit 5be5a014f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View File

@ -105,9 +105,6 @@ async def async_browse_media(
hass, media_content_type, media_content_id, can_play_artist=False hass, media_content_type, media_content_id, can_play_artist=False
) )
if media_content_type == "spotify":
return await spotify.async_browse_media(hass, None, None, can_play_artist=False)
if media_content_type == "library": if media_content_type == "library":
return await hass.async_add_executor_job( return await hass.async_add_executor_job(
library_payload, library_payload,
@ -303,17 +300,8 @@ async def root_payload(
) )
if "spotify" in hass.config.components: if "spotify" in hass.config.components:
children.append( result = await spotify.async_browse_media(hass, None, None)
BrowseMedia( children.extend(result.children)
title="Spotify",
media_class=MEDIA_CLASS_APP,
media_content_id="",
media_content_type="spotify",
thumbnail="https://brands.home-assistant.io/_/spotify/logo.png",
can_play=False,
can_expand=True,
)
)
try: try:
item = await media_source.async_browse_media( item = await media_source.async_browse_media(

View File

@ -522,6 +522,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
""" """
if spotify.is_spotify_media_type(media_type): if spotify.is_spotify_media_type(media_type):
media_type = spotify.resolve_spotify_media_type(media_type) media_type = spotify.resolve_spotify_media_type(media_type)
media_id = spotify.spotify_uri_from_media_browser_url(media_id)
if media_source.is_media_source_id(media_id): if media_source.is_media_source_id(media_id):
media_type = MEDIA_TYPE_MUSIC media_type = MEDIA_TYPE_MUSIC