From e947dcac4380a3af2a16e6db4bdd39bb08593d04 Mon Sep 17 00:00:00 2001 From: Sleeps Date: Tue, 6 Oct 2026 15:58:49 +0100 Subject: [PATCH] Fetch Jellyfin item detail through Items query --- scene_search/jellyfin.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scene_search/jellyfin.py b/scene_search/jellyfin.py index 3d42714..edca92d 100644 --- a/scene_search/jellyfin.py +++ b/scene_search/jellyfin.py @@ -12,6 +12,9 @@ import requests from PIL import Image +ITEM_DETAIL_FIELDS = "Path,MediaSources,Tags,Trickplay,Etag" + + @dataclass(frozen=True) class TrickplaySelection: media_source_id: str | None @@ -101,7 +104,7 @@ class JellyfinClient: "ParentId": library_id, "Recursive": "true", "IncludeItemTypes": "Movie,Episode,Video", - "Fields": "Path", + "Fields": ITEM_DETAIL_FIELDS, "EnableTotalRecordCount": "true", "StartIndex": start, "Limit": request_limit, @@ -120,7 +123,20 @@ class JellyfinClient: return results[:limit] if limit is not None else results def item(self, item_id: str) -> dict[str, Any]: - return self._get(f"/Items/{item_id}").json() + data = self._get( + "/Items", + params={ + "Ids": item_id, + "Recursive": "true", + "Fields": ITEM_DETAIL_FIELDS, + "EnableTotalRecordCount": "false", + "Limit": 1, + }, + ).json() + items = list(data.get("Items") or []) + if not items: + raise RuntimeError(f"Jellyfin item not found: {item_id}") + return items[0] @staticmethod def select_trickplay(