Homelabtoolkit v2

This commit is contained in:
2026-06-08 21:58:16 +12:00
parent 040fbacc70
commit 3c77066beb
75 changed files with 16945 additions and 374 deletions
+18
View File
@@ -129,6 +129,24 @@ async def list_collection_items(client, collection_id: str, user_id: str) -> lis
return [normalize_item(raw) for raw in items]
async def get_collection_item_count(client, collection_id: str) -> int:
"""Ask Emby for the authoritative child count for one collection."""
data = await client.get(
"/Items",
{
"ParentId": collection_id,
"Limit": "1",
"Recursive": "false",
},
)
if isinstance(data, dict):
try:
return int(data.get("TotalRecordCount", len(data.get("Items") or [])))
except (TypeError, ValueError):
return len(data.get("Items") or [])
return len(data or [])
async def add_collection_items(client, collection_id: str, item_ids: list[str]):
"""Add items to a collection by id. No-op for an empty list."""
if not item_ids: