fix: black + isort 格式化
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 22s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1m44s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1540h51m15s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1540h51m19s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1540h51m19s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 22s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1m44s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1540h51m15s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1540h51m19s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1540h51m17s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1540h51m19s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
This commit is contained in:
@@ -238,17 +238,13 @@ class StickerEngine:
|
||||
|
||||
# 贴纸预处理
|
||||
if pre_filters:
|
||||
filter_parts.append(
|
||||
f"[{sticker_idx + 1}:v]{','.join(pre_filters)}[{sticker_label}]"
|
||||
)
|
||||
filter_parts.append(f"[{sticker_idx + 1}:v]{','.join(pre_filters)}[{sticker_label}]")
|
||||
sticker_source = f"[{sticker_label}]"
|
||||
else:
|
||||
sticker_source = f"[{sticker_idx + 1}:v]"
|
||||
|
||||
# overlay 合成
|
||||
filter_parts.append(
|
||||
f"{input_label}{sticker_source}overlay={pos_x:.0f}:{pos_y:.0f}{enable_expr}{output_label}"
|
||||
)
|
||||
filter_parts.append(f"{input_label}{sticker_source}overlay={pos_x:.0f}:{pos_y:.0f}{enable_expr}{output_label}")
|
||||
|
||||
return ";".join(filter_parts)
|
||||
|
||||
@@ -308,9 +304,7 @@ class StickerEngine:
|
||||
|
||||
# 时间范围
|
||||
if sticker.duration > 0:
|
||||
drawtext_params.append(
|
||||
f"enable='between(t,{sticker.start_time},{sticker.start_time + sticker.duration})'"
|
||||
)
|
||||
drawtext_params.append(f"enable='between(t,{sticker.start_time},{sticker.start_time + sticker.duration})'")
|
||||
|
||||
# 淡入淡出(drawtext 没有直接的淡入淡出,用 alpha 表达式模拟)
|
||||
if sticker.fade_in > 0 or sticker.fade_out > 0:
|
||||
@@ -318,14 +312,12 @@ class StickerEngine:
|
||||
parts: list[str] = []
|
||||
if sticker.fade_in > 0:
|
||||
parts.append(
|
||||
f"if(lt(t,{sticker.start_time + sticker.fade_in}),"
|
||||
f"(t-{sticker.start_time})/{sticker.fade_in},1)"
|
||||
f"if(lt(t,{sticker.start_time + sticker.fade_in})," f"(t-{sticker.start_time})/{sticker.fade_in},1)"
|
||||
)
|
||||
if sticker.fade_out > 0 and sticker.duration > 0:
|
||||
fade_out_start = sticker.start_time + sticker.duration - sticker.fade_out
|
||||
parts.append(
|
||||
f"if(gt(t,{fade_out_start}),"
|
||||
f"({sticker.start_time + sticker.duration}-t)/{sticker.fade_out},1)"
|
||||
f"if(gt(t,{fade_out_start})," f"({sticker.start_time + sticker.duration}-t)/{sticker.fade_out},1)"
|
||||
)
|
||||
if parts:
|
||||
alpha_expr = "*".join(parts)
|
||||
@@ -522,15 +514,11 @@ class StickerEngine:
|
||||
# 淡入淡出(使用 fade 的 alpha 模式)
|
||||
fade_filters: list[str] = []
|
||||
if sticker.fade_in > 0:
|
||||
fade_filters.append(
|
||||
f"fade=in:st={sticker.start_time}:d={sticker.fade_in}:alpha=1"
|
||||
)
|
||||
fade_filters.append(f"fade=in:st={sticker.start_time}:d={sticker.fade_in}:alpha=1")
|
||||
if sticker.fade_out > 0 and sticker.duration > 0:
|
||||
fade_out_start = sticker.start_time + sticker.duration - sticker.fade_out
|
||||
if fade_out_start > 0:
|
||||
fade_filters.append(
|
||||
f"fade=out:st={fade_out_start}:d={sticker.fade_out}:alpha=1"
|
||||
)
|
||||
fade_filters.append(f"fade=out:st={fade_out_start}:d={sticker.fade_out}:alpha=1")
|
||||
|
||||
# 估算贴纸尺寸用于位置计算
|
||||
est_w = int(canvas_w * 0.3 * sticker.scale) if not sticker.width else sticker.width
|
||||
@@ -540,26 +528,20 @@ class StickerEngine:
|
||||
# enable 表达式
|
||||
enable_expr = ""
|
||||
if sticker.duration > 0:
|
||||
enable_expr = (
|
||||
f":enable='between(t,{sticker.start_time},{sticker.start_time + sticker.duration})'"
|
||||
)
|
||||
enable_expr = f":enable='between(t,{sticker.start_time},{sticker.start_time + sticker.duration})'"
|
||||
|
||||
parts: list[str] = []
|
||||
|
||||
# 贴纸预处理
|
||||
all_pre = pre_filters + fade_filters
|
||||
if all_pre:
|
||||
parts.append(
|
||||
f"[{sticker_input_idx}:v]{','.join(all_pre)}[{scaled_label}]"
|
||||
)
|
||||
parts.append(f"[{sticker_input_idx}:v]{','.join(all_pre)}[{scaled_label}]")
|
||||
sticker_source = f"[{scaled_label}]"
|
||||
else:
|
||||
sticker_source = f"[{sticker_input_idx}:v]"
|
||||
|
||||
# overlay 合成
|
||||
parts.append(
|
||||
f"{input_label}{sticker_source}overlay={pos_x:.0f}:{pos_y:.0f}{enable_expr}{output_label}"
|
||||
)
|
||||
parts.append(f"{input_label}{sticker_source}overlay={pos_x:.0f}:{pos_y:.0f}{enable_expr}{output_label}")
|
||||
|
||||
return ";".join(parts)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user