Skip to content

Commit

Permalink
语音控制回车换行
Browse files Browse the repository at this point in the history
  • Loading branch information
H1DDENADM1N committed May 10, 2024
1 parent bc4e8b1 commit 6d21db8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions hot-rule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
(艾特)\s*([一幺]六三)\s*点\s* = @163.
(艾特)\s*(\w+)\s*(点)\s*(\w+) = @\2.\4
\s*点\s*(\w+)$ = .\1
回车 = \r\n
换行 = \r\n
12 changes: 6 additions & 6 deletions util/client_rename_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ def rename_audio(task_id, text, time_start) -> Union[Path, None]:

# 确保旧文件存在
if not file_path.exists():
console.print(f' 文件不存在:{file_path}')
console.print(f" 文件不存在:{file_path}")
return

# 构建新文件名
time_year = time.strftime('%Y', time.localtime(time_start))
time_month = time.strftime('%m', time.localtime(time_start))
time_year = time.strftime("%Y", time.localtime(time_start))
time_month = time.strftime("%m", time.localtime(time_start))
time_ymdhms = time.strftime("%Y%m%d-%H%M%S", time.localtime(time_start))
file_stem = f'({time_ymdhms}){text[:Config.audio_name_len]}'
file_stem = re.sub(r'[\\/:"*?<>|]', ' ', file_stem)
file_stem = f"({time_ymdhms}){text[:Config.audio_name_len]}"
file_stem = re.sub(r'[\\/:"*?<>|]', " ", file_stem)
file_stem = re.sub(r"\r\n", " ", file_stem)

This comment has been minimized.

Copy link
@H1DDENADM1N

H1DDENADM1N May 10, 2024

Owner

Fix [WinError 123] 文件名、目录名或卷标语法不正确。 \r\n


# 重命名
file_path_new = file_path.with_name(file_stem + file_path.suffix)
file_path.rename(file_path_new)

# 返回新的录音文件路径
return file_path_new

0 comments on commit 6d21db8

Please sign in to comment.