style: black格式化
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Code Quality (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Successful in 47s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 48s

This commit is contained in:
2026-07-27 08:44:40 +08:00
parent 3df207f315
commit db7f3617c3
@@ -171,9 +171,7 @@ class SubtitleRenderEngine:
except (TypeError, ValueError):
continue
def add_asr_timeline(
self, timeline: Any, style: SubtitleStyle | None = None
) -> None:
def add_asr_timeline(self, timeline: Any, style: SubtitleStyle | None = None) -> None:
"""从 SubtitleTimeline 对象添加 ASR 字幕."""
if not timeline or not hasattr(timeline, "segments") or not timeline.segments:
return
@@ -254,9 +252,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
back_color = style.ass_background_color
else:
border_style = 1
back_color = (
style.ass_shadow_color if style.shadow_enabled else style.ass_font_color
)
back_color = style.ass_shadow_color if style.shadow_enabled else style.ass_font_color
outline_val = style.stroke_width if style.stroke_enabled else 0.0
shadow_val = style.shadow_offset_y if style.shadow_enabled else 0
@@ -289,10 +285,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
start_time = _format_ass_time(max(0, seg.start))
end_time = _format_ass_time(max(seg.start + 0.1, seg.end))
return (
f"Dialogue: 0,{start_time},{end_time},{seg.style_name},,0,0,0,,"
f"{effect_tags}{safe_text}"
)
return f"Dialogue: 0,{start_time},{end_time},{seg.style_name},,0,0,0,," f"{effect_tags}{safe_text}"
@property
def has_subtitles(self) -> bool:
@@ -340,10 +333,7 @@ def build_subtitles_from_plan(
style_dict = title_cfg.get("style") or {}
style = SubtitleStyle.from_dict(style_dict)
# 标题默认样式:顶部、大字号、粗体
if (
style.position == DEFAULT_POSITION
and style.font_size == DEFAULT_FONT_SIZE
):
if style.position == DEFAULT_POSITION and style.font_size == DEFAULT_FONT_SIZE:
style.position = "top_center"
style.font_size = 48
style.bold = True
@@ -419,9 +409,7 @@ def build_subtitle_filter(
# - Windows 路径的 \ → /
# - 冒号 : → \:
# - 单引号 ' → '\''
safe_path = (
ass_path_str.replace("\\", "/").replace(":", "\\:").replace("'", "'\\''")
)
safe_path = ass_path_str.replace("\\", "/").replace(":", "\\:").replace("'", "'\\''")
return f"{video_input_label}subtitles='{safe_path}'[{output_label}]"
@@ -461,6 +449,4 @@ def _validate_subtitle_path(subtitle_path: str, work_dir: Path) -> None:
resolved_path.relative_to(resolved_work_dir)
except ValueError as _e:
if not is_in_allowed_dirs(resolved_path):
raise PathSecurityError(
f"字幕路径不在允许目录内: {subtitle_path[:80]}"
) from _e
raise PathSecurityError(f"字幕路径不在允许目录内: {subtitle_path[:80]}") from _e