fix(titles): normalize titles at stub insert too (RSS/backfill/live-search)
_insert_stubs previously stored the raw title, so a brand-new video showed its unnormalized title until enrichment caught up. Normalize (and stash original_title) at insert as well, so every video-title write path is covered: stub insert, enrichment, live search, and the download worker. Every newly imported feed video is normalized from the first insert.
This commit is contained in:
parent
d55799cbc1
commit
7ae19c2f8d
1 changed files with 5 additions and 0 deletions
|
|
@ -54,6 +54,11 @@ def _insert_stubs(db: Session, rows: list[dict]) -> int:
|
|||
return 0
|
||||
seen: dict[str, dict] = {}
|
||||
for row in rows:
|
||||
# Normalize the title at first insert too (RSS/backfill stubs), so a brand-new video
|
||||
# never flashes its raw title before enrichment refreshes it.
|
||||
raw = row.get("title")
|
||||
if raw:
|
||||
row = {**row, "original_title": raw, "title": normalize_title(raw)}
|
||||
seen[row["id"]] = row
|
||||
stmt = (
|
||||
pg_insert(Video)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue