Commit 945a2b39 authored by 翟艳秋(20软)'s avatar 翟艳秋(20软)

补前一次commit遗漏的部分

parent 172eb5d2
...@@ -36,7 +36,7 @@ def speech_synthesis(text, output_file, speed): ...@@ -36,7 +36,7 @@ def speech_synthesis(text, output_file, speed):
audio_config = AudioOutputConfig(filename=audio_path) audio_config = AudioOutputConfig(filename=audio_path)
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config) synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
synthesizer.speak_text_async(text) synthesizer.speak_text(text)
if float(speed) != 1.0: if float(speed) != 1.0:
change_speed(output_file, speed) change_speed(output_file, speed)
......
...@@ -214,6 +214,18 @@ def start_synthesis(): ...@@ -214,6 +214,18 @@ def start_synthesis():
caption_path = captionPath.get() caption_path = captionPath.get()
# 判断各个变量的合理性 # 判断各个变量的合理性
if len(video_path) == 0:
messagebox.showwarning("警告", "请给出原视频存放路径")
return
elif not os.path.exists(video_path):
messagebox.showwarning("警告", "当前给出的视频路径有误,请检查一遍")
return
if len(sheet_path) == 0:
messagebox.showwarning("警告", "请选择你要处理的表格")
return
elif not os.path.exists(sheet_path):
messagebox.showwarning("警告", "当前输入的表格不存在,请检查一遍。")
return
if len(audio_dir) == 0: if len(audio_dir) == 0:
messagebox.showwarning("警告", "请选择音频存放路径") messagebox.showwarning("警告", "请选择音频存放路径")
return return
...@@ -222,11 +234,7 @@ def start_synthesis(): ...@@ -222,11 +234,7 @@ def start_synthesis():
return return
if len(caption_path) == 0: if len(caption_path) == 0:
messagebox.showwarning("警告", "请选择字幕文件存放路径") messagebox.showwarning("警告", "请选择字幕文件存放路径")
if len(sheet_path) == 0:
messagebox.showwarning("警告", "请选择你要处理的表格")
return return
elif not os.path.exists(sheet_path):
messagebox.showwarning("警告", "当前输入的表格不存在,请检查一遍。")
# 显示进度条、进度条百分比及任务状态提示文本 # 显示进度条、进度条百分比及任务状态提示文本
startSynthesis.config(state=tk.DISABLED) startSynthesis.config(state=tk.DISABLED)
...@@ -320,10 +328,10 @@ tabControl.pack(expand=1, fill="both") ...@@ -320,10 +328,10 @@ tabControl.pack(expand=1, fill="both")
video_info = ttk.LabelFrame(tab1, text=" 视频信息操作 ") video_info = ttk.LabelFrame(tab1, text=" 视频信息操作 ")
video_info.place(relx=0.05, rely=0.05, relwidth=0.9, relheight=0.4) video_info.place(relx=0.05, rely=0.05, relwidth=0.9, relheight=0.4)
rows = 4 # rows = 4
for i in range(rows): # for i in range(rows):
video_info.grid_rowconfigure(i, weight=1) # video_info.grid_rowconfigure(i, weight=1)
video_info.grid_columnconfigure(i, weight=1) # video_info.grid_columnconfigure(i, weight=1)
input_label = ttk.Label(video_info, text="视频文件") input_label = ttk.Label(video_info, text="视频文件")
input_label.grid(column=0, row=0) input_label.grid(column=0, row=0)
...@@ -364,10 +372,10 @@ choice_3.grid(column=3, row=3, sticky="W") ...@@ -364,10 +372,10 @@ choice_3.grid(column=3, row=3, sticky="W")
detect_command = ttk.LabelFrame(tab1, text=" 检测步骤 ") detect_command = ttk.LabelFrame(tab1, text=" 检测步骤 ")
detect_command.place(relx=0.05, rely=0.6, relwidth=0.9, relheight=0.3) detect_command.place(relx=0.05, rely=0.6, relwidth=0.9, relheight=0.3)
rows = 4 # rows = 4
for i in range(rows): # for i in range(rows):
detect_command.grid_rowconfigure(i, weight=1) # detect_command.grid_rowconfigure(i, weight=1)
detect_command.grid_columnconfigure(i, weight=1) # detect_command.grid_columnconfigure(i, weight=1)
output_label = ttk.Label(detect_command, text="输出表格") output_label = ttk.Label(detect_command, text="输出表格")
output_label.grid(column=0, row=0) output_label.grid(column=0, row=0)
...@@ -401,10 +409,10 @@ stopDetection.config(state=tk.DISABLED) ...@@ -401,10 +409,10 @@ stopDetection.config(state=tk.DISABLED)
audio_info = ttk.LabelFrame(tab2, text=" 语音相关设置 ") audio_info = ttk.LabelFrame(tab2, text=" 语音相关设置 ")
audio_info.place(relx=0.05, rely=0.05, relwidth=0.9, relheight=0.3) audio_info.place(relx=0.05, rely=0.05, relwidth=0.9, relheight=0.3)
rows = 3 # rows = 3
for i in range(rows): # for i in range(rows):
audio_info.grid_rowconfigure(i, weight=1) # audio_info.grid_rowconfigure(i, weight=1)
audio_info.grid_columnconfigure(i, weight=1) # audio_info.grid_columnconfigure(i, weight=1)
video_label = ttk.Label(audio_info, text="原视频") video_label = ttk.Label(audio_info, text="原视频")
video_label.grid(column=0, row=0) video_label.grid(column=0, row=0)
...@@ -441,10 +449,10 @@ speedChosen.grid(column=1, row=2, sticky="W") ...@@ -441,10 +449,10 @@ speedChosen.grid(column=1, row=2, sticky="W")
synthesis_command = ttk.LabelFrame(tab2, text=" 语音合成步骤 ") synthesis_command = ttk.LabelFrame(tab2, text=" 语音合成步骤 ")
synthesis_command.place(relx=0.05, rely=0.45, relwidth=0.9, relheight=0.4) synthesis_command.place(relx=0.05, rely=0.45, relwidth=0.9, relheight=0.4)
rows = 4 # rows = 4
for i in range(rows): # for i in range(rows):
synthesis_command.grid_rowconfigure(i, weight=1) # synthesis_command.grid_rowconfigure(i, weight=1)
synthesis_command.grid_columnconfigure(i, weight=1) # synthesis_command.grid_columnconfigure(i, weight=1)
audioDir_label = ttk.Label(synthesis_command, text="输出音频存放于") audioDir_label = ttk.Label(synthesis_command, text="输出音频存放于")
audioDir_label.grid(column=0, row=0) audioDir_label.grid(column=0, row=0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment