From a631d3099ac8c10f5791c46dfefc2842869b079e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Sat, 21 Dec 2024 10:21:34 +0000 Subject: [PATCH] Fix: Limit images to 512x512 My Chromecast Ultra crashes when presented with cover images on the order of 5000x5000 pixels (I've not determined the actual limit, 2048x2048 is ok though). This sets the default size in the player queue to 512x512 which affects all players, as well as a chromecast specific codepath. Of the other callers of `get_image_url` airplay already sets a size of 500x500 while the slimproto and sonos players do not set any limit. Fixes: https://github.com/music-assistant/hass-music-assistant/issues/3285 --- music_assistant/controllers/player_queues.py | 2 +- music_assistant/providers/chromecast/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/music_assistant/controllers/player_queues.py b/music_assistant/controllers/player_queues.py index eb52f897e..48498ba25 100644 --- a/music_assistant/controllers/player_queues.py +++ b/music_assistant/controllers/player_queues.py @@ -1261,7 +1261,7 @@ def player_media_from_queue_item(self, queue_item: QueueItem, flow_mode: bool) - album.name if (album := getattr(queue_item.media_item, "album", None)) else "" ) if queue_item.image: - media.image_url = self.mass.metadata.get_image_url(queue_item.image) + media.image_url = self.mass.metadata.get_image_url(queue_item.image, size=512) return media async def get_artist_tracks(self, artist: Artist) -> list[Track]: diff --git a/music_assistant/providers/chromecast/__init__.py b/music_assistant/providers/chromecast/__init__.py index fdd5ff549..b206bde92 100644 --- a/music_assistant/providers/chromecast/__init__.py +++ b/music_assistant/providers/chromecast/__init__.py @@ -675,7 +675,7 @@ async def update_flow_metadata(self, castplayer: CastPlayer) -> None: # update metadata of current item chromecast if media_controller.status.media_custom_data["queue_item_id"] != current_item.queue_item_id: image_url = ( - self.mass.metadata.get_image_url(current_item.image) + self.mass.metadata.get_image_url(current_item.image, size=512) if current_item.image else MASS_LOGO_ONLINE )