Fixed GIF commands for real (lol)

This commit is contained in:
TheEssem 2020-10-19 20:24:53 -05:00
parent 5e34e45ac4
commit a03d3a5e79
9 changed files with 35 additions and 20 deletions

View file

@ -17,11 +17,12 @@ app.post("/run", express.json(), async (req, res, next) => {
try {
let type;
if (object.path) {
type = await magick.getType(object.path);
type = object.type ? object.type : await magick.getType(object.path);
if (!type) {
return res.sendStatus(400);
}
object.type = type.split("/")[1];
if (object.type !== "gif" && object.onlyGIF) return res.send("nogif");
const delay = (await execPromise(`ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate ${object.path}`)).stdout.replace("\n", "");
object.delay = (100 / delay.split("/")[0]) * delay.split("/")[1];
}