This commit is contained in:
2025-09-24 10:50:34 +08:00
parent c055a68592
commit ec1705769c
18 changed files with 348 additions and 330 deletions

View File

@@ -2,7 +2,7 @@ import logging
import os
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from typing import Dict, Any, List, Optional
from typing import Dict, Any, Optional
from opentelemetry.trace import Status, StatusCode
@@ -125,7 +125,11 @@ class DefaultTaskService(TaskService):
# 报告任务成功
api.report_task_success(
task_info,
videoInfo={"width": width, "height": height, "duration": duration},
videoInfo={
"width": width,
"height": height,
"duration": duration,
},
)
span.set_status(Status(StatusCode.OK))
@@ -249,7 +253,10 @@ class DefaultTaskService(TaskService):
)
def _parse_video_source(
self, source: str, task_params: Dict[str, Any], template_info: Dict[str, Any]
self,
source: str,
task_params: Dict[str, Any],
template_info: Dict[str, Any],
) -> tuple[Optional[str], Dict[str, Any]]:
"""解析视频源"""
if source.startswith("PLACEHOLDER_"):
@@ -274,7 +281,10 @@ class DefaultTaskService(TaskService):
return os.path.join(template_info.get("local_path", ""), source), {}
def _check_placeholder_exist_with_count(
self, placeholder_id: str, task_params: Dict[str, Any], required_count: int = 1
self,
placeholder_id: str,
task_params: Dict[str, Any],
required_count: int = 1,
) -> bool:
"""检查占位符是否存在足够数量的片段"""
if placeholder_id in task_params: