Слияние: режиссёр в карточке загрузки (T2)

# Conflicts:
#	docs/backlog/README.md
This commit is contained in:
av
2026-07-17 21:22:35 +03:00
16 changed files with 612 additions and 93 deletions
+5 -28
View File
@@ -1135,35 +1135,12 @@ func (w *Worker) effectivePlan(ctx context.Context, id string) (plan recognize.P
return applyOverrides(plan, overrides), prov, pid, nil
}
// effectiveDisplayName собирает полный ярлык display_name из эффективных полей:
// плана (override → распознавание+матч, уже свёрнуто effectivePlan) с fallback на
// сохранённый контекст (parsed_context) для полей, которых план не дал (например
// режиссёр из контекста при распознавании без матча). Сводка сезонов —
// recognize.SeasonSummary(plan) с fallback на контекстный скаляр. Единый формат с
// шагом добавления (общий naming.Label). parsed_context недоверен: битый JSON →
// пустой слой (best-effort), очистка полей — на рендере.
// effectiveDisplayName собирает полный ярлык display_name из эффективных полей.
// Тонкая обёртка над naming.EffectiveFields (слоистое разрешение план →
// контекст) + Label — единый источник разрешения полей ярлыка, общий со
// страницей загрузки и экраном ревью.
func effectiveDisplayName(d store.Download, plan recognize.Plan) string {
var ctxf naming.Fields
if s := strings.TrimSpace(d.ParsedContext); s != "" {
_ = json.Unmarshal([]byte(s), &ctxf)
}
title := plan.Title
if title == "" {
title = ctxf.Title
}
director := plan.Director
if director == "" {
director = ctxf.Director
}
year := plan.Year
if year == 0 {
year = ctxf.Year
}
season := recognize.SeasonSummary(plan)
if season == "" && plan.Type == recognize.MediaSeries {
season = ctxf.SeasonLabel()
}
return naming.Label(title, director, year, season)
return naming.EffectiveFields(d.ParsedContext, plan).Label()
}
// RefreshDisplayName — внешняя точка входа обновления отображаемого имени