chore: update formats

This commit is contained in:
C4illin 2024-11-21 22:50:38 +01:00
parent 4c05fd72bb
commit 465aacbf9b

View file

@ -1,143 +1,144 @@
import { exec } from "node:child_process"; import { exec } from "node:child_process";
// This could be done dynamically by running `ffmpeg -formats` and parsing the output // This could be done dynamically by running `ffmpeg -formats` and parsing the output
export const properties = { export const properties = {
from: { from: {
muxer: [ muxer: [
"3d", "3d",
"3ds", "3ds",
"3mf", "3mf",
"ac", "ac",
"ac3d", "ac3d",
"acc", "acc",
"amf", "amf",
"ase", "amj",
"ask", "ase",
"assbin", "ask",
"b3d", "assbin",
"blend", "b3d",
"bsp", "blend",
"bvh", "bsp",
"cob", "bvh",
"csm", "cob",
"dae", "csm",
"dxf", "dae",
"enff", "dxf",
"fbx", "enff",
"glb", "fbx",
"gltf", "glb",
"hmp", "gltf",
"ifc", "hmb",
"ifczip", "hmp",
"iqm", "ifc",
"irr", "ifczip",
"irrmesh", "iqm",
"lwo", "irr",
"lws", "irrmesh",
"lxo", "lwo",
"md2", "lws",
"md3", "lxo",
"md5anim", "m3d",
"md5camera", "md2",
"md5mesh", "md3",
"mdc", "md5anim",
"mdl", "md5camera",
"mesh.xml", "md5mesh",
"mesh", "mdc",
"mot", "mdl",
"ms3d", "mesh.xml",
"ndo", "mesh",
"nff", "mot",
"obj", "ms3d",
"off", "ndo",
"ogex", "nff",
"pk3", "obj",
"ply", "off",
"pmx", "ogex",
"prj", "pk3",
"q3o", "ply",
"q3s", "pmx",
"raw", "prj",
"scn", "q3o",
"sib", "q3s",
"smd", "raw",
"step", "scn",
"stl", "sib",
"stp", "smd",
"ter", "step",
"uc", "stl",
"usd", "stp",
"usda", "ter",
"usdc", "uc",
"usdz", "usd",
"vta", "usda",
"x", "usdc",
"x3d", "usdz",
"x3db", "vta",
"xgl", "x",
"xml", "x3d",
"zae", "x3db",
"zgl", "xgl",
], "xml",
}, "zae",
to: { "zgl",
muxer: [ ],
"3ds", },
"3mf", to: {
"assbin", muxer: [
"assjson", "3ds",
"assxml", "3mf",
"collada", "assbin",
"dae", "assjson",
"fbx", "assxml",
"fbxa", "collada",
"glb", "dae",
"glb2", "fbx",
"gltf", "fbxa",
"gltf2", "glb",
"m3d", "glb2",
"m3da", "gltf",
"obj", "gltf2",
"objnomtl", "json",
"pbrt", "obj",
"ply", "objnomtl",
"plyb", "pbrt",
"stl", "ply",
"stlb", "plyb",
"stp", "stl",
"x", "stlb",
"x3d", "stp",
], "x",
}, ],
}; },
};
export async function convert(
filePath: string, export async function convert(
fileType: string, filePath: string,
convertTo: string, fileType: string,
targetPath: string, convertTo: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars targetPath: string,
options?: unknown, // eslint-disable-next-line @typescript-eslint/no-unused-vars
): Promise<string> { options?: unknown,
// let command = "ffmpeg"; ): Promise<string> {
// let command = "ffmpeg";
const command = `assimp export "${filePath}" "${targetPath}"`;
const command = `assimp export "${filePath}" "${targetPath}"`;
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => { return new Promise((resolve, reject) => {
if (error) { exec(command, (error, stdout, stderr) => {
reject(`error: ${error}`); if (error) {
} reject(`error: ${error}`);
}
if (stdout) {
console.log(`stdout: ${stdout}`); if (stdout) {
} console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`); if (stderr) {
} console.error(`stderr: ${stderr}`);
}
resolve("Done");
}); resolve("Done");
}); });
} });
}