mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Get media player features elsewhere for jellyfin (#148805)
This commit is contained in:
parent
a6e1d96852
commit
b522bd5ef2
@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
@ -21,6 +22,8 @@ from .const import CONTENT_TYPE_MAP, LOGGER, MAX_IMAGE_WIDTH
|
||||
from .coordinator import JellyfinConfigEntry, JellyfinDataUpdateCoordinator
|
||||
from .entity import JellyfinClientEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
@ -177,10 +180,15 @@ class JellyfinMediaPlayer(JellyfinClientEntity, MediaPlayerEntity):
|
||||
def supported_features(self) -> MediaPlayerEntityFeature:
|
||||
"""Flag media player features that are supported."""
|
||||
commands: list[str] = self.capabilities.get("SupportedCommands", [])
|
||||
controllable = self.capabilities.get("SupportsMediaControl", False)
|
||||
_LOGGER.debug(
|
||||
"Supported commands for device %s, client %s, %s",
|
||||
self.device_name,
|
||||
self.client_name,
|
||||
commands,
|
||||
)
|
||||
features = MediaPlayerEntityFeature(0)
|
||||
|
||||
if controllable:
|
||||
if "PlayMediaSource" in commands:
|
||||
features |= (
|
||||
MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||
|
@ -21,7 +21,7 @@
|
||||
],
|
||||
"Capabilities": {
|
||||
"PlayableMediaTypes": ["Video"],
|
||||
"SupportedCommands": ["VolumeSet", "Mute"],
|
||||
"SupportedCommands": ["VolumeSet", "Mute", "PlayMediaSource"],
|
||||
"SupportsMediaControl": true,
|
||||
"SupportsContentUploading": true,
|
||||
"MessageCallbackUrl": "string",
|
||||
|
@ -182,6 +182,7 @@
|
||||
'SupportedCommands': list([
|
||||
'VolumeSet',
|
||||
'Mute',
|
||||
'PlayMediaSource',
|
||||
]),
|
||||
'SupportsContentUploading': True,
|
||||
'SupportsMediaControl': True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user