Commit a1b08947 by Nick N. Sukharev

Обновлена версия модуля customTts.js до шаблонной

1 parent ccfca291
Showing with 8 additions and 4 deletions
......@@ -36,7 +36,7 @@ class AudioResources
}
const audioFile = path.join(folder, phrase.audio);
if (!fs.existsSync(audioFile)) {
errors.push(`For ${i} phrase "${phrase.phrase}" file not found`);
errors.push(`For ${i} phrase '${phrase.phrase}' file not found`);
continue;
}
phrase.voice = { ...pack.voice, ...phrase.voice };
......@@ -48,24 +48,28 @@ class AudioResources
}
this.resources[resourceKey] = audioFile;
}
if(errors.length > 0)
if (errors.length > 0)
{
console.error(`Was errors ${JSON.stringify(errors)}`)
console.error(`Was errors: ${JSON.stringify(errors, undefined, 2)}`);
return false;
}
return true;
}
async addFolder(folder)
{
const files = fs.readdirSync(folder);
let result = false;
for (const fileName of files)
{
if (path.extname(fileName) === ".json")
{
const fname = path.join(folder, fileName);
console.log(`Parsing ${fname}`);
await this.appendJson(folder, JSON.parse(fs.readFileSync(fname).toString()));
result = await this.appendJson(folder, JSON.parse(fs.readFileSync(fname).toString()));
}
}
return result;
}
GetPath(text, voiceInfo)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!