Compare commits
2 commits
159547e799
...
7b173c68f5
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b173c68f5 | |||
| 4c0e25ad33 |
1 changed files with 11 additions and 3 deletions
14
src/tts.ts
14
src/tts.ts
|
|
@ -62,6 +62,14 @@ async function main() {
|
||||||
|
|
||||||
const home = os.homedir();
|
const home = os.homedir();
|
||||||
const cwd = path.join(home, ".ttsc");
|
const cwd = path.join(home, ".ttsc");
|
||||||
|
const firstRun = await (async () => {
|
||||||
|
try {
|
||||||
|
await fs.access(cwd, fs.constants.F_OK);
|
||||||
|
return false;
|
||||||
|
} catch {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
if (editContent) {
|
if (editContent) {
|
||||||
const file = path.join(cwd, "input.txt");
|
const file = path.join(cwd, "input.txt");
|
||||||
|
|
@ -90,7 +98,7 @@ async function main() {
|
||||||
cwd,
|
cwd,
|
||||||
input,
|
input,
|
||||||
stdout: "pipe",
|
stdout: "pipe",
|
||||||
stderr: "inherit",
|
stderr: firstRun ? "inherit" : "ignore",
|
||||||
})`uv run -- python -u main.py`;
|
})`uv run -- python -u main.py`;
|
||||||
|
|
||||||
if (!waitAndCombine) {
|
if (!waitAndCombine) {
|
||||||
|
|
@ -139,7 +147,7 @@ async function main() {
|
||||||
stdin: "ignore",
|
stdin: "ignore",
|
||||||
stdout: "inherit",
|
stdout: "inherit",
|
||||||
stderr: "inherit",
|
stderr: "inherit",
|
||||||
})`mpv${pausePlayer ? " --pause" : ""} ${file}`;
|
})`mpv ${pausePlayer ? ["--pause"] : []} ${file}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +182,7 @@ async function main() {
|
||||||
stdin: "ignore",
|
stdin: "ignore",
|
||||||
stdout: "inherit",
|
stdout: "inherit",
|
||||||
stderr: "inherit",
|
stderr: "inherit",
|
||||||
})`mpv${pausePlayer ? " --pause" : ""} output.wav`;
|
})`mpv ${pausePlayer ? ["--pause"] : []} output.wav`;
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(handleTopLevel);
|
main().catch(handleTopLevel);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue