Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/kodi/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,11 @@ async def _get_thumbnail_url(
return response

async def async_get_browse_image(
self, media_content_type, media_content_id, media_image_id=None
):
self,
media_content_type: str,
media_content_id: str,
media_image_id: str | None = None,
) -> tuple[bytes | None, str | None]:
"""Get media image from kodi server."""
try:
image_url, _, _ = await get_media_info(
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/philips_js/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,11 @@ async def async_browse_media(self, media_content_type=None, media_content_id=Non
raise BrowseError(f"Media not found: {media_content_type} / {media_content_id}")

async def async_get_browse_image(
self, media_content_type, media_content_id, media_image_id=None
):
self,
media_content_type: str,
media_content_id: str,
media_image_id: str | None = None,
) -> tuple[bytes | None, str | None]:
"""Serve album art. Returns (content, content_type)."""
try:
if media_content_type == MEDIA_TYPE_APP and media_content_id:
Expand Down
9 changes: 7 additions & 2 deletions homeassistant/components/plex/media_player.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Support to interface with the Plex API."""
from __future__ import annotations

from functools import wraps
import json
import logging
Expand Down Expand Up @@ -571,8 +573,11 @@ async def async_browse_media(self, media_content_type=None, media_content_id=Non
)

async def async_get_browse_image(
self, media_content_type, media_content_id, media_image_id=None
):
self,
media_content_type: str,
media_content_id: str,
media_image_id: str | None = None,
) -> tuple[bytes | None, str | None]:
"""Get media image from Plex server."""
image_url = self.plex_server.thumbnail_cache.get(media_content_id)
if image_url:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/sonos/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,10 @@ def extra_state_attributes(self) -> dict[str, Any]:

async def async_get_browse_image(
self,
media_content_type: str | None,
media_content_id: str | None,
media_content_type: str,
media_content_id: str,
media_image_id: str | None = None,
) -> tuple[None | str, None | str]:
) -> tuple[bytes | None, str | None]:
"""Fetch media browser image to serve via proxy."""
if (
media_content_type in [MEDIA_TYPE_ALBUM, MEDIA_TYPE_ARTIST]
Expand Down
9 changes: 7 additions & 2 deletions homeassistant/components/squeezebox/media_player.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Support for interfacing to the Logitech SqueezeBox API."""
from __future__ import annotations

import asyncio
import json
import logging
Expand Down Expand Up @@ -562,8 +564,11 @@ async def async_browse_media(self, media_content_type=None, media_content_id=Non
return await build_item_response(self, self._player, payload)

async def async_get_browse_image(
self, media_content_type, media_content_id, media_image_id=None
):
self,
media_content_type: str,
media_content_id: str,
media_image_id: str | None = None,
) -> tuple[bytes | None, str | None]:
"""Get album art from Squeezebox server."""
if media_image_id:
image_url = self._player.generate_image_url_from_track_id(media_image_id)
Expand Down