mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 14:19:11 +02:00
Fix
This commit is contained in:
@@ -69,16 +69,18 @@ module.exports = class DECTalkCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async tts(id, input) {
|
async tts(id, input) {
|
||||||
await writeFile(path.join(__dirname, '..', '..', 'tmp', `${id}.txt`), input);
|
const inputFile = path.join(__dirname, '..', '..', 'tmp', `${id}.txt`);
|
||||||
await execAsync(`xvfb-run wine say.exe -w ${id}.wav < ${path.join(__dirname, '..', '..', 'tmp', `${id}.txt`)}`, {
|
await writeFile(inputFile, input);
|
||||||
|
const outputFile = path.join(__dirname, '..', '..', 'tmp', `${id}.wav`);
|
||||||
|
await execAsync(`xvfb-run wine say.exe -w ${outputFile} < ${inputFile}`, {
|
||||||
cwd: path.join(__dirname, '..', '..', 'dectalk'),
|
cwd: path.join(__dirname, '..', '..', 'dectalk'),
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
});
|
});
|
||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
result = await readFile(path.join(__dirname, '..', '..', 'tmp', `${id}.wav`));
|
result = await readFile(outputFile);
|
||||||
await unlink(path.join(__dirname, '..', '..', 'tmp', `${id}.txt`));
|
await unlink(inputFile);
|
||||||
await unlink(path.join(__dirname, '..', '..', 'tmp', `${id}.wav`));
|
await unlink(outputFile);
|
||||||
} catch {
|
} catch {
|
||||||
if (!result) result = null;
|
if (!result) result = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user