fix(cover): E2兜底封面标题样式透传color/position/font_size (#1467)
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 47s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m30s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 3m5s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m53s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 3m25s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m37s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 22s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 38s
AI Code Review / AI Code Review (pull_request) Successful in 3m23s
CI/CD Pipeline / Build Staging API Image (push) Successful in 5m27s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m14s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m28s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m24s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m5s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m18s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 1m31s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 8m6s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 8m9s
CI/CD Pipeline / Integration Tests (push) Successful in 3m1s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m45s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m28s
CI/CD Pipeline / Unit Tests (push) Successful in 14m12s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 11m29s
CI/CD Pipeline / CI Gate (pull_request) Successful in 9s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 576h14m5s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 576h14m7s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Production Browser E2E (push) Failing after 576h14m45s
CI/CD Pipeline / Canary Release to Production (push) Failing after 576h14m47s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 576h14m48s
CI/CD Pipeline / Build Production Web Image (push) Failing after 576h14m49s
CI/CD Pipeline / CI Gate (push) Failing after 576h14m49s
CI/CD Pipeline / Build Production API Image (push) Failing after 576h14m49s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 576h24m5s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 576h24m9s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 576h24m11s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 576h25m38s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 576h24m52s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 576h25m39s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 576h27m8s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 576h27m12s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 576h27m16s
CI/CD Pipeline / Frontend Lint (push) Failing after 576h29m2s
CI/CD Pipeline / PR Build Web Image (push) Failing after 576h27m18s
CI/CD Pipeline / PR Build API Image (push) Failing after 576h27m20s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 576h29m4s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 576h47m55s
CI/CD Pipeline / Deploy Production (push) Failing after 576h48m35s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 576h57m55s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 576h59m24s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 577h0m58s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 47s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 1m30s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 3m5s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 1m53s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 3m25s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m37s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 22s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 38s
AI Code Review / AI Code Review (pull_request) Successful in 3m23s
CI/CD Pipeline / Build Staging API Image (push) Successful in 5m27s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m14s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m28s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m24s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m5s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 1m18s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 1m31s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 8m6s
CI/CD Pipeline / Validate - Code Quality (pull_request) Successful in 8m9s
CI/CD Pipeline / Integration Tests (push) Successful in 3m1s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m45s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m28s
CI/CD Pipeline / Unit Tests (push) Successful in 14m12s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 11m29s
CI/CD Pipeline / CI Gate (pull_request) Successful in 9s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 576h14m5s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 576h14m7s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 576h14m9s
CI/CD Pipeline / Production Browser E2E (push) Failing after 576h14m45s
CI/CD Pipeline / Canary Release to Production (push) Failing after 576h14m47s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 576h14m48s
CI/CD Pipeline / Build Production Web Image (push) Failing after 576h14m49s
CI/CD Pipeline / CI Gate (push) Failing after 576h14m49s
CI/CD Pipeline / Build Production API Image (push) Failing after 576h14m49s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 576h24m5s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 576h24m9s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 576h24m11s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 576h25m38s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 576h24m52s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Failing after 576h25m39s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 576h27m8s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 576h27m12s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 576h27m16s
CI/CD Pipeline / Frontend Lint (push) Failing after 576h29m2s
CI/CD Pipeline / PR Build Web Image (push) Failing after 576h27m18s
CI/CD Pipeline / PR Build API Image (push) Failing after 576h27m20s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 576h29m4s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 576h47m55s
CI/CD Pipeline / Deploy Production (push) Failing after 576h48m35s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 576h57m55s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 576h59m24s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 577h0m58s
This commit was merged in pull request #1467.
This commit is contained in:
@@ -63,7 +63,15 @@ class GenerateCoverResponse(BaseModel):
|
||||
# ── Route ────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def _persist_cover_frame(frame_url: str, plan_id: str, title_text: str = "") -> str:
|
||||
def _persist_cover_frame(
|
||||
frame_url: str,
|
||||
plan_id: str,
|
||||
title_text: str = "",
|
||||
*,
|
||||
title_color: str = "#ffffff",
|
||||
title_position: str = "bottom",
|
||||
title_font_size: int | None = None,
|
||||
) -> str:
|
||||
"""下载 MediaKit 返回的临时帧图,可选叠加标题后转存到 OSS covers/ 路径。
|
||||
|
||||
Args:
|
||||
@@ -71,6 +79,9 @@ def _persist_cover_frame(frame_url: str, plan_id: str, title_text: str = "") ->
|
||||
plan_id: 剪辑计划 ID(生成 OSS key)
|
||||
title_text: 非空时用 Pillow 在帧上叠加标题(用于 E2 从源素材抽帧,
|
||||
因为源素材本身没有烧录标题)
|
||||
title_color: 标题字体颜色(#RRGGBB)
|
||||
title_position: 标题位置 top/center/bottom
|
||||
title_font_size: 标题字号,None 时自动计算
|
||||
"""
|
||||
import tempfile
|
||||
import uuid
|
||||
@@ -94,7 +105,13 @@ def _persist_cover_frame(frame_url: str, plan_id: str, title_text: str = "") ->
|
||||
try:
|
||||
from packages.shared.title_overlay import apply_title_to_image
|
||||
|
||||
applied = apply_title_to_image(tmp_path, title_text)
|
||||
applied = apply_title_to_image(
|
||||
tmp_path,
|
||||
title_text,
|
||||
color=title_color,
|
||||
position=title_position,
|
||||
font_size=title_font_size,
|
||||
)
|
||||
if applied:
|
||||
logger.info("[封面生成] E2 帧图已叠加标题: plan_id=%s", plan_id)
|
||||
except Exception:
|
||||
@@ -418,11 +435,15 @@ def generate_cover(
|
||||
asset_repo = SQLAlchemyAssetRepository(db)
|
||||
storage_svc = get_shared_storage_service()
|
||||
mk_client = get_mediakit_client()
|
||||
# 从 plan.config 读取标题,E2 从源素材抽帧时叠加(源素材本身无标题)
|
||||
# 从 plan.config 读取完整标题样式,E2 从源素材抽帧时叠加(源素材本身无标题)
|
||||
_e2_title_cfg = (plan.config or {}).get("title", {}) or {}
|
||||
if not isinstance(_e2_title_cfg, dict):
|
||||
_e2_title_cfg = {}
|
||||
_e2_title_text = (_e2_title_cfg.get("text", "") or "").strip() if _e2_title_cfg.get("enabled", True) else ""
|
||||
# 读取标题样式:前端可能传 color 或 font_color,都兼容
|
||||
_e2_title_color = _e2_title_cfg.get("color") or _e2_title_cfg.get("font_color") or "#ffffff"
|
||||
_e2_title_position = _e2_title_cfg.get("position", "bottom") or "bottom"
|
||||
_e2_title_font_size = _e2_title_cfg.get("font_size") or _e2_title_cfg.get("size")
|
||||
if mk_client.is_available:
|
||||
for aid in body.asset_ids:
|
||||
try:
|
||||
@@ -452,7 +473,14 @@ def generate_cover(
|
||||
if snapshots:
|
||||
raw = snapshots[0].get("image_url") or snapshots[0].get("url") or ""
|
||||
if raw:
|
||||
cover_url_from_task = _persist_cover_frame(raw, plan_id, title_text=_e2_title_text)
|
||||
cover_url_from_task = _persist_cover_frame(
|
||||
raw,
|
||||
plan_id,
|
||||
title_text=_e2_title_text,
|
||||
title_color=_e2_title_color,
|
||||
title_position=_e2_title_position,
|
||||
title_font_size=_e2_title_font_size,
|
||||
)
|
||||
logger.info(
|
||||
"[封面生成] 统一管道封面(步骤E-source-asset): plan_id=%s url=%s",
|
||||
plan_id,
|
||||
|
||||
Reference in New Issue
Block a user