renderizando projetos no mmpCreator utilizando o lmms
Deploy / Deploy (push) Successful in 2m16s
Details
Deploy / Deploy (push) Successful in 2m16s
Details
This commit is contained in:
parent
b26955e03d
commit
c90852441c
|
|
@ -658,19 +658,20 @@ app.use((req, res, next) => {
|
||||||
const LMMS_BIN = process.env.LMMS_BIN || "lmms";
|
const LMMS_BIN = process.env.LMMS_BIN || "lmms";
|
||||||
const LMMS_TIMEOUT_MS = Number(process.env.LMMS_TIMEOUT_MS || 5 * 60 * 1000);
|
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, ext) {
|
||||||
function buildLmmsCommand(inputMmp, outputAudio) {
|
// ✅ igual ao Python: -r input -o output -f ext
|
||||||
const useXvfb =
|
const lmmsArgs = ["-r", inputMmp, "-o", outputAudio, "-f", ext];
|
||||||
process.env.LMMS_USE_XVFB === "1" ||
|
|
||||||
(!process.env.DISPLAY && process.env.LMMS_USE_XVFB !== "0");
|
// Só usa xvfb se você pedir explicitamente
|
||||||
|
const useXvfb = process.env.LMMS_USE_XVFB === "1";
|
||||||
|
|
||||||
if (useXvfb) {
|
if (useXvfb) {
|
||||||
// xvfb-run -a lmms -r in.mmp -o out.wav
|
return { cmd: "xvfb-run", args: ["-a", LMMS_BIN, ...lmmsArgs] };
|
||||||
return { cmd: "xvfb-run", args: ["-a", LMMS_BIN, "-r", inputMmp, "-o", outputAudio] };
|
|
||||||
}
|
}
|
||||||
return { cmd: LMMS_BIN, args: ["-r", inputMmp, "-o", outputAudio] };
|
return { cmd: LMMS_BIN, args: lmmsArgs };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sanitizeFileName(name) {
|
function sanitizeFileName(name) {
|
||||||
return String(name || "projeto")
|
return String(name || "projeto")
|
||||||
.normalize("NFKD")
|
.normalize("NFKD")
|
||||||
|
|
@ -747,7 +748,7 @@ app.post("/render", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(inputPath, projectXml, "utf8");
|
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 });
|
await run(cmd, args, { timeoutMs: LMMS_TIMEOUT_MS });
|
||||||
|
|
||||||
const fileBase = sanitizeFileName(name || roomName || "projeto");
|
const fileBase = sanitizeFileName(name || roomName || "projeto");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue