change markdown download folder
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -38,9 +38,14 @@ def process_audio_file(audio_file_path):
|
||||
file_name_with_extension = os.path.basename(audio_file_path)
|
||||
file_name_without_extension = os.path.splitext(file_name_with_extension)[0]
|
||||
logging.info(f"Starting processing {file_name_with_extension}")
|
||||
# 获取 WAV 文件所在的目录
|
||||
wav_dir = os.path.dirname(audio_file_path)
|
||||
# 获取 MP4 文件的文件名(不包含扩展名)
|
||||
wav_filename = os.path.splitext(os.path.basename(audio_file_path))[0]
|
||||
# 生成对应的 WAV 文件路径
|
||||
md_file = os.path.join(wav_dir, f"{wav_filename}.md")
|
||||
|
||||
try:
|
||||
# audio_file = AudioSegment.from_mp3(audio_file_path)
|
||||
audio_file = AudioSegment.from_wav(audio_file_path)
|
||||
audio_chunks = split_on_silence(audio_file, min_silence_len=500, silence_thresh=-40)
|
||||
|
||||
@@ -106,8 +111,8 @@ def process_audio_file(audio_file_path):
|
||||
markdown_content += f"{sentence[1]}\n\n"
|
||||
|
||||
with file_write_lock: # 确保文件写入操作的线程安全
|
||||
md_file_path = os.path.join('media', file_name_without_extension + '.md')
|
||||
with open(md_file_path, "w", encoding="utf-8") as f:
|
||||
# md_file_path = os.path.join('media', file_name_without_extension + '.md')
|
||||
with open(md_file, "w", encoding="utf-8") as f:
|
||||
f.write(markdown_content)
|
||||
|
||||
logging.info(f"Finished processing {file_name_with_extension}")
|
||||
|
||||
Reference in New Issue
Block a user