Files
project-kino/nextcloud-import/backend-nextcloud-variant/app/services/jellyfin.py
Hermes Agent 884c198783 Import remaining Nextcloud Kino-Projekt material into git
Moves git-compatible content from Nextcloud
(Botomir/Projekte/Angefangen/Kino-Projekt) into this repo per cleanup
request, under nextcloud-import/ to avoid colliding with the actively
maintained backend/frontend/worker layout:

- status/planning docs (Botomir-Status.md, Plan-Botomir.md, Projektbeschreibung.md)
- docs/ (deployment.md, provider-policy.md)
- backend-nextcloud-variant/ (older app/ layout, kept for reference only)
- plugin.video.xstream/, script.module.xstreamscraper/ (vendored Kodi addon source)

A third-party Firefox extension folder was intentionally left in Nextcloud
(unrelated vendor code, not project source).
2026-08-17 10:47:13 +02:00

24 lines
726 B
Python

import httpx
from app.config import Settings
class JellyfinRefreshSkipped(RuntimeError):
pass
async def refresh_jellyfin(settings: Settings) -> bool:
"""Trigger Jellyfin's library refresh when credentials are configured.
Returns False when no API key is present so local/dev imports can still finish
without writing secrets into the project tree.
"""
if not settings.jellyfin_api_key:
return False
url = settings.jellyfin_url.rstrip("/") + "/Library/Refresh"
headers = {"X-Emby-Token": settings.jellyfin_api_key}
async with httpx.AsyncClient(timeout=20) as client:
response = await client.post(url, headers=headers)
response.raise_for_status()
return True