Signed-off-by: Sy03 <1370724210@qq.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: Dan250124 <416947747@qq.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
13 lines
319 B
Python
13 lines
319 B
Python
"""Shared helpers for custom voice profile tools."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
|
|
def safe_voice_stem(name: str) -> str:
|
|
stem = re.sub(r"[^a-zA-Z0-9_.-]+", "_", name.strip())
|
|
if not stem or stem in (".", ".."):
|
|
raise ValueError(f"Invalid voice name: {name!r}")
|
|
return stem[:200]
|