diff --git a/burn_only.py b/burn_only.py index 8359ffd..da07aeb 100644 --- a/burn_only.py +++ b/burn_only.py @@ -4,19 +4,18 @@ 直接用已有的 clips + title.srt + content.srt 合并烧录 用法: - python burn_only.py python burn_only.py "D:\\path\\to\\output_dir" """ import sys import os -# 导入统一配置 -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -import config +# 必须指定输出目录 +if len(sys.argv) < 2: + print("用法: python burn_only.py ") + print("示例: python burn_only.py \"D:\\path\\to\\output_dir\"") + sys.exit(1) -OUTPUT = config.OUTPUT -if len(sys.argv) > 1: - OUTPUT = sys.argv[1] +OUTPUT = sys.argv[1] TITLE_SRT = os.path.join(OUTPUT, "subs", "v1_title.srt") CONTENT_SRT = os.path.join(OUTPUT, "subs", "v1_content.srt") @@ -40,16 +39,24 @@ src_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src") sys.path.insert(0, src_dir) from core import Pipeline -# 构造 minimal config(只需要 output_dir 和 video_params) -pipeline_config = { - 'output_dir': OUTPUT, - 'clips': [], - 'video_src': None, - 'video_params': {}, - 'term_corrections': {}, - 'api_key': '', - 'api_host': '', -} +# 尝试从 generated_config.yaml 加载配置 +config_path = os.path.join(OUTPUT, 'generated_config.yaml') +if os.path.exists(config_path): + import yaml + with open(config_path, 'r', encoding='utf-8') as f: + pipeline_config = yaml.safe_load(f) or {} + pipeline_config['output_dir'] = OUTPUT +else: + # 构造 minimal config + pipeline_config = { + 'output_dir': OUTPUT, + 'clips': [], + 'video_src': None, + 'video_params': {}, + 'term_corrections': {}, + 'api_key': '', + 'api_host': '', + } pipeline = Pipeline(pipeline_config)