diff --git a/homeassistant/components/media_source/models.py b/homeassistant/components/media_source/models.py index b48ee784c238..8ebf87b98d59 100644 --- a/homeassistant/components/media_source/models.py +++ b/homeassistant/components/media_source/models.py @@ -7,10 +7,9 @@ from typing import Any, cast from homeassistant.components.media_player import BrowseMedia from homeassistant.components.media_player.const import ( - MEDIA_CLASS_CHANNEL, - MEDIA_CLASS_DIRECTORY, - MEDIA_TYPE_CHANNEL, - MEDIA_TYPE_CHANNELS, + MEDIA_CLASS_APP, + MEDIA_TYPE_APP, + MEDIA_TYPE_APPS, ) from homeassistant.core import HomeAssistant, callback @@ -58,19 +57,20 @@ class MediaSourceItem: base = BrowseMediaSource( domain=None, identifier=None, - media_class=MEDIA_CLASS_DIRECTORY, - media_content_type=MEDIA_TYPE_CHANNELS, + media_class=MEDIA_CLASS_APP, + media_content_type=MEDIA_TYPE_APPS, title="Media Sources", can_play=False, can_expand=True, - children_media_class=MEDIA_CLASS_CHANNEL, + children_media_class=MEDIA_CLASS_APP, ) base.children = [ BrowseMediaSource( domain=source.domain, identifier=None, - media_class=MEDIA_CLASS_CHANNEL, - media_content_type=MEDIA_TYPE_CHANNEL, + media_class=MEDIA_CLASS_APP, + media_content_type=MEDIA_TYPE_APP, + thumbnail=f"https://brands.home-assistant.io/_/{source.domain}/logo.png", title=source.name, can_play=False, can_expand=True, diff --git a/homeassistant/components/sonos/media_browser.py b/homeassistant/components/sonos/media_browser.py index e999121ecc2f..2887884c2746 100644 --- a/homeassistant/components/sonos/media_browser.py +++ b/homeassistant/components/sonos/media_browser.py @@ -263,7 +263,7 @@ async def root_payload( media_class=MEDIA_CLASS_DIRECTORY, media_content_id="", media_content_type="spotify", - thumbnail="https://brands.home-assistant.io/spotify/icon.png", + thumbnail="https://brands.home-assistant.io/spotify/logo.png", can_play=False, can_expand=True, ) diff --git a/homeassistant/components/spotify/__init__.py b/homeassistant/components/spotify/__init__.py index 5393e0e8eb95..37f2d7f00577 100644 --- a/homeassistant/components/spotify/__init__.py +++ b/homeassistant/components/spotify/__init__.py @@ -64,6 +64,7 @@ async def async_browse_media( return await async_browse_media_internal( hass, info[DATA_SPOTIFY_CLIENT], + info[DATA_SPOTIFY_SESSION], info[DATA_SPOTIFY_ME], media_content_type, media_content_id, diff --git a/homeassistant/components/spotify/media_player.py b/homeassistant/components/spotify/media_player.py index c60c8891cf4d..396899c37ff0 100644 --- a/homeassistant/components/spotify/media_player.py +++ b/homeassistant/components/spotify/media_player.py @@ -524,13 +524,19 @@ class SpotifyMediaPlayer(MediaPlayerEntity): raise NotImplementedError return await async_browse_media_internal( - self.hass, self._spotify, self._me, media_content_type, media_content_id + self.hass, + self._spotify, + self._session, + self._me, + media_content_type, + media_content_id, ) async def async_browse_media_internal( hass, spotify, + session, current_user, media_content_type, media_content_id, @@ -543,6 +549,8 @@ async def async_browse_media_internal( partial(library_payload, can_play_artist=can_play_artist) ) + await session.async_ensure_token_valid() + # Strip prefix media_content_type = media_content_type[len(MEDIA_PLAYER_PREFIX) :]