Upload app.py
Browse files
app.py
CHANGED
|
@@ -140,6 +140,8 @@ def smart_wrap(text, video_width=1920):
|
|
| 140 |
# 创建caption字幕文件(底部显示)
|
| 141 |
def create_caption_subtitle_file(project_dir, captions, panel_start_times, panel_durations):
|
| 142 |
try:
|
|
|
|
|
|
|
| 143 |
with open(subtitle_file, "w", encoding="utf-8") as f:
|
| 144 |
f.write(ASS_STYLE_HEADER)
|
| 145 |
for i, (caption, start, duration) in enumerate(zip(captions, panel_start_times, panel_durations)):
|
|
@@ -157,6 +159,8 @@ def create_caption_subtitle_file(project_dir, captions, panel_start_times, panel
|
|
| 157 |
# 创建speech字幕文件(顶部显示)
|
| 158 |
def create_speech_subtitle_file(project_dir, speeches, panel_start_times, panel_durations):
|
| 159 |
try:
|
|
|
|
|
|
|
| 160 |
with open(subtitle_file, "w", encoding="utf-8") as f:
|
| 161 |
f.write(ASS_STYLE_HEADER)
|
| 162 |
for i, (speech, start, duration) in enumerate(zip(speeches, panel_start_times, panel_durations)):
|
|
|
|
| 140 |
# 创建caption字幕文件(底部显示)
|
| 141 |
def create_caption_subtitle_file(project_dir, captions, panel_start_times, panel_durations):
|
| 142 |
try:
|
| 143 |
+
subtitle_file = os.path.join(project_dir, "captions.ass")
|
| 144 |
+
|
| 145 |
with open(subtitle_file, "w", encoding="utf-8") as f:
|
| 146 |
f.write(ASS_STYLE_HEADER)
|
| 147 |
for i, (caption, start, duration) in enumerate(zip(captions, panel_start_times, panel_durations)):
|
|
|
|
| 159 |
# 创建speech字幕文件(顶部显示)
|
| 160 |
def create_speech_subtitle_file(project_dir, speeches, panel_start_times, panel_durations):
|
| 161 |
try:
|
| 162 |
+
subtitle_file = os.path.join(project_dir, "speeches.ass")
|
| 163 |
+
|
| 164 |
with open(subtitle_file, "w", encoding="utf-8") as f:
|
| 165 |
f.write(ASS_STYLE_HEADER)
|
| 166 |
for i, (speech, start, duration) in enumerate(zip(speeches, panel_start_times, panel_durations)):
|