aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-09-01 22:42:31 -0700
committerAdam Soltys <[email protected]>2023-09-01 22:42:38 -0700
commit68a2aede36519b4d5891c9427e5cddc699082189 (patch)
tree652c1bcd5abe16cf9ad3b6a836088e2a60e14fcd
parent8d19a2ab496770856a6780c553c7eae350bc3494 (diff)
downloadcoinos-server-68a2aede36519b4d5891c9427e5cddc699082189.tar.gz
coinos-server-68a2aede36519b4d5891c9427e5cddc699082189.zip
cleanup
-rw-r--r--lib/payments.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/payments.js b/lib/payments.js
index 72beaac6..c8e74201 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -185,10 +185,14 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
parseFloat(((amount * p.rate) / 100000000).toFixed(2))
);
- const client = mqtt.connect("mqtt://ln.coinos.io", config.mqtt);
- const raw = `/app/data/uploads/${p.id}-raw.mp3`;
- const out = `/app/data/uploads/${p.id}.mp3`;
- const mimic = spawn("/mimic", [
+ let client = mqtt.connect("mqtt://ln.coinos.io", config.mqtt);
+ client.subscribe(username);
+
+ let raw = `/app/data/uploads/${p.id}-raw.mp3`;
+ let out = `/app/data/uploads/${p.id}.mp3`;
+
+ let connected;
+ let mimic = spawn("/mimic", [
"-t",
words,
"-voice",
@@ -196,9 +200,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
"-o",
raw
]);
- let connected;
-
- client.subscribe(username);
mimic.stdout.on("end", async () => {
await wait(() => connected);
@@ -233,6 +234,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
for (let n of missing) send(chunk);
client.publish(username, `end:${n}`);
}
+ });
ffmpeg(raw)
.audioBitrate(128)
@@ -267,7 +269,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
);
setTimeout(() => (connected = true), 50);
});
- });
}
return p;