sentence database builder script

This commit is contained in:
polv committed 2026-08-29 11:06:38 +07:00
1 parent 1118bda30f
commit cac640fdea
4 files changed
+135 -61

No files matched your search

+8 -2
View File
@@ -49,11 +49,17 @@ async function gtts(
fileList = JSON.parse(fs.readFileSync(fileListJSON, "utf-8"));
}
const fileNo = fileList[text] || Object.keys(fileList).length;
let fileNo = fileList[text];
let isFileNoExists = Number.isInteger(fileNo);
if (!isFileNoExists) {
fileNo = Math.max(0, ...Object.values(fileList)) + 1;
}
const filename = `${fileNo}.mp3`;
const saveto = path.join(saveroot, filename);
if (!fs.existsSync(saveto)) {
if (!isFileNoExists || !fs.existsSync(saveto)) {
await new Promise((resolve, reject) => {
const p = spawn(
"gtts-cli",