feat: wrap TTS output text to terminal width
This commit is contained in:
parent
b9610663a6
commit
ea5b3728a5
1 changed files with 4 additions and 2 deletions
6
tts.ts
6
tts.ts
|
|
@ -69,12 +69,14 @@ for await (const line of koko.stdout) {
|
||||||
first = false;
|
first = false;
|
||||||
const stop = Date.now();
|
const stop = Date.now();
|
||||||
const duration = ((stop - start) / 1000).toFixed(2);
|
const duration = ((stop - start) / 1000).toFixed(2);
|
||||||
console.log(chalk.blue(`\nTime-to-audio: ${duration}s`));
|
console.log(chalk.green(`\nTime-to-audio: ${duration}s`));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const info of infos) {
|
for (const info of infos) {
|
||||||
|
const [columns] = process.stdout.getWindowSize();
|
||||||
|
const text = Bun.wrapAnsi(info.text, columns);
|
||||||
const file = `${home}/.ttsc/${info.file}.wav`;
|
const file = `${home}/.ttsc/${info.file}.wav`;
|
||||||
console.log(`\n${chalk.blue(file)}:\n${info.text}\n`);
|
console.log(`\n${chalk.blue(file)}:\n${text}\n`);
|
||||||
|
|
||||||
if (!wait) {
|
if (!wait) {
|
||||||
await Bun.spawn({
|
await Bun.spawn({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue