From: Marcel van der Veldt Date: Sat, 20 Dec 2025 20:40:37 +0000 (+0100) Subject: More fixes for (spotify) playlists handling X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=f033bfcbb16988a3f82bce9147340ccb7bcb720c;p=music-assistant-server.git More fixes for (spotify) playlists handling --- diff --git a/music_assistant/controllers/media/playlists.py b/music_assistant/controllers/media/playlists.py index b7b95195..e658a3cc 100644 --- a/music_assistant/controllers/media/playlists.py +++ b/music_assistant/controllers/media/playlists.py @@ -454,7 +454,9 @@ class PlaylistController(MediaControllerBase[Playlist]): This is used to link objects of different providers/qualities together. """ - self.logger.debug("Matching providers for playlists is not possible, ignoring request") + # playlists can only be matched on the same provider (if not unique) + if self.mass.music.match_provider_instances(db_item): + await self.add_provider_mappings(db_item.item_id, db_item.provider_mappings) def _refresh_playlist_tracks(self, playlist: Playlist) -> None: """Refresh playlist tracks by forcing a cache refresh.""" diff --git a/music_assistant/providers/spotify/provider.py b/music_assistant/providers/spotify/provider.py index 2652481d..b6ec37a7 100644 --- a/music_assistant/providers/spotify/provider.py +++ b/music_assistant/providers/spotify/provider.py @@ -379,8 +379,8 @@ class SpotifyProvider(MusicProvider): try: playlist_obj = await self._get_data(f"playlists/{prov_playlist_id}") return parse_playlist(playlist_obj, self) - except aiohttp.ClientResponseError as err: - if err.status == 400 and self.dev_session_active: + except MediaNotFoundError: + if self.dev_session_active: # Remember that this playlist requires global token await self._set_playlist_requires_global_token(prov_playlist_id) playlist_obj = await self._get_data( @@ -1183,7 +1183,7 @@ class SpotifyProvider(MusicProvider): raise ResourceTemporarilyUnavailable("Token expired", backoff_time=1) # handle 404 not found, convert to MediaNotFoundError - if response.status == 404: + if response.status in (400, 404): raise MediaNotFoundError(f"{endpoint} not found") response.raise_for_status() result: dict[str, Any] = await response.json(loads=json_loads)