Fix snapshot title fallback (build 271261228)

This commit is contained in:
2026-01-27 12:30:04 +13:00
parent 8b1a09fbd4
commit 0e95f94025
2 changed files with 22 additions and 2 deletions

View File

@@ -1 +1 @@
271261219 271261228

View File

@@ -11,7 +11,14 @@ from ..clients.radarr import RadarrClient
from ..clients.prowlarr import ProwlarrClient from ..clients.prowlarr import ProwlarrClient
from ..clients.qbittorrent import QBittorrentClient from ..clients.qbittorrent import QBittorrentClient
from ..runtime import get_runtime_settings from ..runtime import get_runtime_settings
from ..db import save_snapshot, get_request_cache_payload, get_recent_snapshots, get_setting, set_setting from ..db import (
save_snapshot,
get_request_cache_payload,
get_request_cache_by_id,
get_recent_snapshots,
get_setting,
set_setting,
)
from ..models import ActionOption, NormalizedState, RequestType, Snapshot, TimelineHop from ..models import ActionOption, NormalizedState, RequestType, Snapshot, TimelineHop
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -219,6 +226,19 @@ async def build_snapshot(request_id: str) -> Snapshot:
logging.getLogger(__name__).debug( logging.getLogger(__name__).debug(
"snapshot cache miss: request_id=%s mode=%s", request_id, mode "snapshot cache miss: request_id=%s mode=%s", request_id, mode
) )
if cached_request is not None:
cache_meta = get_request_cache_by_id(int(request_id))
cached_title = cache_meta.get("title") if cache_meta else None
if cached_title and isinstance(cached_request, dict):
media = cached_request.get("media")
if not isinstance(media, dict):
media = {}
cached_request["media"] = media
if not media.get("title") and not media.get("name"):
media["title"] = cached_title
media["name"] = cached_title
if not cached_request.get("title") and not cached_request.get("name"):
cached_request["title"] = cached_title
allow_remote = mode == "always_js" and jellyseerr.configured() allow_remote = mode == "always_js" and jellyseerr.configured()
if not jellyseerr.configured() and not cached_request: if not jellyseerr.configured() and not cached_request: