Get media player features elsewhere for jellyfin (#148805)

This commit is contained in:
Josef Zweck 2025-07-15 12:07:57 +02:00 committed by GitHub
parent a6e1d96852
commit b522bd5ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -21,7 +21,7 @@
],
"Capabilities": {
"PlayableMediaTypes": ["Video"],
"SupportedCommands": ["VolumeSet", "Mute"],
"SupportedCommands": ["VolumeSet", "Mute", "PlayMediaSource"],
"SupportsMediaControl": true,
"SupportsContentUploading": true,
"MessageCallbackUrl": "string",

View File

@ -182,6 +182,7 @@
'SupportedCommands': list([
'VolumeSet',
'Mute',
'PlayMediaSource',
]),
'SupportsContentUploading': True,
'SupportsMediaControl': True,