Skip to content

Commit

Permalink
Fix: Limit images to 512x512
Browse files Browse the repository at this point in the history
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: music-assistant/hass-music-assistant#3285
  • Loading branch information
ijc committed Dec 21, 2024
1 parent 8a069cd commit a631d30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion music_assistant/controllers/player_queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion music_assistant/providers/chromecast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit a631d30

Please sign in to comment.