Add Jellyfin handoff progress job

This commit is contained in:
Dymas
2026-06-14 13:09:46 +02:00
parent 6403c98b7d
commit 332ec670fc
8 changed files with 475 additions and 35 deletions
+7 -2
View File
@@ -52,6 +52,7 @@ class HandlerContext:
ensure_runtime: object
episode_list: object
get_config_snapshot: object
get_jellyfin_sync_status: object
get_watchlist_homepage_summary: object
get_watchlist: object
get_watchlist_refresh_status: object
@@ -64,6 +65,7 @@ class HandlerContext:
save_runtime_config: object
search_anime: object
resolve_search_thumbnail: object
start_jellyfin_sync: object
test_discord_webhook_config: object
thumbnail_file_path: object
update_all_watchlist_statuses: object
@@ -168,7 +170,7 @@ class Handler(BaseHTTPRequestHandler):
server_version = "AniCliWeb/1.0"
remote_session_cookie_name = "ani_cli_web_session"
remote_session_cookie_max_age_seconds = 30 * 24 * 60 * 60
quiet_poll_paths = {"/api/queue", "/api/watchlist/refresh-status"}
quiet_poll_paths = {"/api/queue", "/api/watchlist/refresh-status", "/api/config/jellyfin/sync-status"}
def _context(self):
context = getattr(self, "handler_context", None) or getattr(type(self), "handler_context", None)
@@ -616,6 +618,9 @@ class Handler(BaseHTTPRequestHandler):
elif parsed.path == "/api/watchlist/refresh-status":
Handler._runtime(self)
self.json(Handler._context(self).get_watchlist_refresh_status())
elif parsed.path == "/api/config/jellyfin/sync-status":
Handler._runtime(self)
self.json(Handler._context(self).get_jellyfin_sync_status())
else:
self.error(HTTPStatus.NOT_FOUND, "Not found")
except Exception as exc:
@@ -656,7 +661,7 @@ class Handler(BaseHTTPRequestHandler):
):
if str(merged.get(key) or "").strip():
Handler.validate_remote_path(self, merged[key], label)
self.json(Handler._context(self).run_jellyfin_sync(merged))
self.json(Handler._context(self).start_jellyfin_sync(merged), HTTPStatus.ACCEPTED)
elif parsed.path == "/api/config/webhook/test":
payload = Handler.require_json_object(self, self.body_json())
validate_discord_webhook_url(payload.get("discord_webhook_url"))