From c90852441c341ae9d5f9c06fad52b6d81f2640f5 Mon Sep 17 00:00:00 2001 From: JotaChina Date: Sun, 28 Dec 2025 16:17:06 -0300 Subject: [PATCH] renderizando projetos no mmpCreator utilizando o lmms --- assets/js/creations/server/server.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/assets/js/creations/server/server.js b/assets/js/creations/server/server.js index 864d12a8..3f23e659 100755 --- a/assets/js/creations/server/server.js +++ b/assets/js/creations/server/server.js @@ -658,19 +658,20 @@ app.use((req, res, next) => { const LMMS_BIN = process.env.LMMS_BIN || "lmms"; const LMMS_TIMEOUT_MS = Number(process.env.LMMS_TIMEOUT_MS || 5 * 60 * 1000); -// opcional (pra servidor sem display): LMMS_USE_XVFB=1 -function buildLmmsCommand(inputMmp, outputAudio) { - const useXvfb = - process.env.LMMS_USE_XVFB === "1" || - (!process.env.DISPLAY && process.env.LMMS_USE_XVFB !== "0"); +function buildLmmsCommand(inputMmp, outputAudio, ext) { + // ✅ igual ao Python: -r input -o output -f ext + const lmmsArgs = ["-r", inputMmp, "-o", outputAudio, "-f", ext]; + + // Só usa xvfb se você pedir explicitamente + const useXvfb = process.env.LMMS_USE_XVFB === "1"; if (useXvfb) { - // xvfb-run -a lmms -r in.mmp -o out.wav - return { cmd: "xvfb-run", args: ["-a", LMMS_BIN, "-r", inputMmp, "-o", outputAudio] }; + return { cmd: "xvfb-run", args: ["-a", LMMS_BIN, ...lmmsArgs] }; } - return { cmd: LMMS_BIN, args: ["-r", inputMmp, "-o", outputAudio] }; + return { cmd: LMMS_BIN, args: lmmsArgs }; } + function sanitizeFileName(name) { return String(name || "projeto") .normalize("NFKD") @@ -747,7 +748,7 @@ app.post("/render", async (req, res) => { try { fs.writeFileSync(inputPath, projectXml, "utf8"); - const { cmd, args } = buildLmmsCommand(inputPath, outputPath); + const { cmd, args } = buildLmmsCommand(inputPath, outputPath, ext); await run(cmd, args, { timeoutMs: LMMS_TIMEOUT_MS }); const fileBase = sanitizeFileName(name || roomName || "projeto");