Skip to content

Commit b522bd5

Browse files
authored
Get media player features elsewhere for jellyfin (home-assistant#148805)
1 parent a6e1d96 commit b522bd5

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

homeassistant/components/jellyfin/media_player.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import logging
56
from typing import Any
67

78
from homeassistant.components.media_player import (
@@ -21,6 +22,8 @@
2122
from .coordinator import JellyfinConfigEntry, JellyfinDataUpdateCoordinator
2223
from .entity import JellyfinClientEntity
2324

25+
_LOGGER = logging.getLogger(__name__)
26+
2427

2528
async def async_setup_entry(
2629
hass: HomeAssistant,
@@ -177,10 +180,15 @@ def media_image_url(self) -> str | None:
177180
def supported_features(self) -> MediaPlayerEntityFeature:
178181
"""Flag media player features that are supported."""
179182
commands: list[str] = self.capabilities.get("SupportedCommands", [])
180-
controllable = self.capabilities.get("SupportsMediaControl", False)
183+
_LOGGER.debug(
184+
"Supported commands for device %s, client %s, %s",
185+
self.device_name,
186+
self.client_name,
187+
commands,
188+
)
181189
features = MediaPlayerEntityFeature(0)
182190

183-
if controllable:
191+
if "PlayMediaSource" in commands:
184192
features |= (
185193
MediaPlayerEntityFeature.BROWSE_MEDIA
186194
| MediaPlayerEntityFeature.PLAY_MEDIA

tests/components/jellyfin/fixtures/sessions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
"Capabilities": {
2323
"PlayableMediaTypes": ["Video"],
24-
"SupportedCommands": ["VolumeSet", "Mute"],
24+
"SupportedCommands": ["VolumeSet", "Mute", "PlayMediaSource"],
2525
"SupportsMediaControl": true,
2626
"SupportsContentUploading": true,
2727
"MessageCallbackUrl": "string",

tests/components/jellyfin/snapshots/test_diagnostics.ambr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
'SupportedCommands': list([
183183
'VolumeSet',
184184
'Mute',
185+
'PlayMediaSource',
185186
]),
186187
'SupportsContentUploading': True,
187188
'SupportsMediaControl': True,

0 commit comments

Comments
 (0)