Improve request handling and qBittorrent categories
This commit is contained in:
@@ -20,6 +20,7 @@ from ..db import (
|
||||
clear_requests_cache,
|
||||
clear_history,
|
||||
cleanup_history,
|
||||
update_request_cache_title,
|
||||
)
|
||||
from ..runtime import get_runtime_settings
|
||||
from ..clients.sonarr import SonarrClient
|
||||
@@ -56,10 +57,12 @@ SETTING_KEYS: List[str] = [
|
||||
"sonarr_api_key",
|
||||
"sonarr_quality_profile_id",
|
||||
"sonarr_root_folder",
|
||||
"sonarr_qbittorrent_category",
|
||||
"radarr_base_url",
|
||||
"radarr_api_key",
|
||||
"radarr_quality_profile_id",
|
||||
"radarr_root_folder",
|
||||
"radarr_qbittorrent_category",
|
||||
"prowlarr_base_url",
|
||||
"prowlarr_api_key",
|
||||
"qbittorrent_base_url",
|
||||
@@ -274,7 +277,28 @@ async def read_logs(lines: int = 200) -> Dict[str, Any]:
|
||||
|
||||
@router.get("/requests/cache")
|
||||
async def requests_cache(limit: int = 50) -> Dict[str, Any]:
|
||||
return {"rows": get_request_cache_overview(limit)}
|
||||
rows = get_request_cache_overview(limit)
|
||||
missing_titles = [row for row in rows if not row.get("title")]
|
||||
if missing_titles:
|
||||
runtime = get_runtime_settings()
|
||||
client = JellyseerrClient(runtime.jellyseerr_base_url, runtime.jellyseerr_api_key)
|
||||
if client.configured():
|
||||
for row in missing_titles:
|
||||
request_id = row.get("request_id")
|
||||
if not isinstance(request_id, int):
|
||||
continue
|
||||
details = await requests_router._get_request_details(client, request_id)
|
||||
if not isinstance(details, dict):
|
||||
continue
|
||||
payload = requests_router._parse_request_payload(details)
|
||||
title = payload.get("title")
|
||||
if not title:
|
||||
continue
|
||||
row["title"] = title
|
||||
if payload.get("year"):
|
||||
row["year"] = payload.get("year")
|
||||
update_request_cache_title(request_id, title, payload.get("year"))
|
||||
return {"rows": rows}
|
||||
|
||||
|
||||
@router.post("/branding/logo")
|
||||
|
||||
Reference in New Issue
Block a user