Improve browse_media type hints in media player (#90060)
* Improve browse_media type hints in media player * Adjust components * Adjust base entitypull/90256/head
parent
5f3868b141
commit
f56bf134d2
|
@ -136,7 +136,7 @@ class BraviaTVMediaPlayer(BraviaTVEntity, MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Browse apps and channels."""
|
||||
|
|
|
@ -767,7 +767,7 @@ class DlnaDmrEntity(MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper.
|
||||
|
|
|
@ -115,7 +115,9 @@ class EsphomeMediaPlayer(
|
|||
)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -836,7 +836,7 @@ class ForkedDaapdMaster(MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
|
|
|
@ -328,7 +328,9 @@ class AFSAPIDevice(MediaPlayerEntity):
|
|||
await self.fs_device.set_eq_preset(mode)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Browse media library and preset stations."""
|
||||
if not media_content_id:
|
||||
|
|
|
@ -72,7 +72,7 @@ class FullyMediaPlayer(FullyKioskEntity, MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the WebSocket media browsing helper."""
|
||||
|
|
|
@ -166,7 +166,9 @@ class GstreamerDevice(MediaPlayerEntity):
|
|||
return self._album
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -427,7 +427,9 @@ class HeosMediaPlayer(MediaPlayerEntity):
|
|||
return self._player.volume / 100
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -283,7 +283,9 @@ class JellyfinMediaPlayer(JellyfinEntity, MediaPlayerEntity):
|
|||
self.coordinator.api_client.jellyfin.remote_unmute(self.session_id)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Return a BrowseMedia instance.
|
||||
|
||||
|
|
|
@ -884,7 +884,9 @@ class KodiEntity(MediaPlayerEntity):
|
|||
return sorted(out, key=lambda out: out[1], reverse=True)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
is_internal = is_internal_request(self.hass)
|
||||
|
|
|
@ -1037,7 +1037,7 @@ class MediaPlayerEntity(Entity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Return a BrowseMedia instance.
|
||||
|
|
|
@ -509,7 +509,9 @@ class MpdDevice(MediaPlayerEntity):
|
|||
await self._client.seekcur(position)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -347,7 +347,9 @@ class OpenhomeDevice(MediaPlayerEntity):
|
|||
await self._device.set_mute(mute)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -203,7 +203,9 @@ class PanasonicVieraTVEntity(MediaPlayerEntity):
|
|||
await self._remote.async_play_media(media_type, media_id)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(self.hass, media_content_id)
|
||||
|
|
|
@ -391,7 +391,9 @@ class PhilipsTVMediaPlayer(
|
|||
)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
if not self._tv.on:
|
||||
|
|
|
@ -541,7 +541,9 @@ class PlexMediaPlayer(MediaPlayerEntity):
|
|||
)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
is_internal = is_internal_request(self.hass)
|
||||
|
|
|
@ -278,7 +278,7 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
|
|
|
@ -498,7 +498,9 @@ class RoonDevice(MediaPlayerEntity):
|
|||
)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await self.hass.async_add_executor_job(
|
||||
|
|
|
@ -195,7 +195,9 @@ class SlimProtoPlayer(MediaPlayerEntity):
|
|||
await self.player.play_url(media_id, mime_type=to_send_media_type)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(
|
||||
|
|
|
@ -712,7 +712,9 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||
return (None, None)
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_browser.async_browse_media(
|
||||
|
|
|
@ -398,7 +398,9 @@ class SoundTouchMediaPlayer(MediaPlayerEntity):
|
|||
return attributes
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
return await media_source.async_browse_media(self.hass, media_content_id)
|
||||
|
|
|
@ -398,7 +398,9 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
|
|||
self._playlist = self.data.client.playlist(current["context"]["uri"])
|
||||
|
||||
async def async_browse_media(
|
||||
self, media_content_type: str | None = None, media_content_id: str | None = None
|
||||
self,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Implement the websocket media browsing helper."""
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ class UniversalMediaPlayer(MediaPlayerEntity):
|
|||
|
||||
async def async_browse_media(
|
||||
self,
|
||||
media_content_type: str | None = None,
|
||||
media_content_type: MediaType | str | None = None,
|
||||
media_content_id: str | None = None,
|
||||
) -> BrowseMedia:
|
||||
"""Return a BrowseMedia instance."""
|
||||
|
|
|
@ -2003,7 +2003,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
TypeHintMatch(
|
||||
function_name="async_browse_media",
|
||||
arg_types={
|
||||
1: "str | None",
|
||||
1: "MediaType | str | None",
|
||||
2: "str | None",
|
||||
},
|
||||
return_type="BrowseMedia",
|
||||
|
|
Loading…
Reference in New Issue