fix(resolver): refresh thumbnails on re-scrape instead of fill-only-if-null

_upsert_playback_sources only set thumbnail_url when the existing value was NULL,
so signed CDN thumbnails that ROT (sxyprn/trafficdeposit tokens expire ~weekly →
404) were never replaced even when a fresh re-scrape captured a valid URL — making
the rot permanent (bug 2026-06-10). Always overwrite thumbnail_url/animated_thumbnail_url
with the freshly-scraped value when present; other fields keep fill-if-null. Lets
the regular performer-driven ingest self-heal thumbnails for re-crawled scenes.

(Note: old sxyprn backlog can't be bulk-refreshed — search/listings don't re-surface
those posts, verified 0 overlap — so it's forward-looking; old sxyprn-only scenes
fall back to the clean placeholder.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jtrzupek 2026-06-10 10:28:18 +02:00
parent 32c18a6d0f
commit bb9e1afc31

View file

@ -644,15 +644,23 @@ def _sync_playback_sources(
)
)
else:
# Refresh + uzupełnij braki (nigdy nie nadpisujemy istniejących wartości).
# Refresh + uzupełnij braki (nie nadpisujemy istniejących wartości).
existing.last_seen_at = datetime.now(UTC)
if existing.scene_id != scene_id:
# Ten sam (origin, page_url) trafił do innej canonical sceny — to znaczy
# że dedup zmergował. Re-link do bieżącej.
existing.scene_id = scene_id
for attr in ("embed_url", "stream_url", "quality", "duration_sec", "thumbnail_url", "animated_thumbnail_url"):
for attr in ("embed_url", "stream_url", "quality", "duration_sec"):
if getattr(existing, attr) is None and getattr(ps, attr) is not None:
setattr(existing, attr, getattr(ps, attr))
# Thumbnaile ZAWSZE odśwież do świeżej wartości ze scrape (gdy podana).
# Signed CDN thumbnaile (sxyprn/trafficdeposit) rotują — token wygasa po
# ~tygodniach i stary URL daje 404. Trzymanie "tylko gdy NULL" robiło rot
# permanentnym (bug 2026-06-10). Re-scrape teraz odświeża martwe miniaturki.
for attr in ("thumbnail_url", "animated_thumbnail_url"):
new_val = getattr(ps, attr)
if new_val is not None:
setattr(existing, attr, new_val)
def _log_auto_merge(