valid handbrake preset

This commit is contained in:
Simon 2024-01-19 08:43:13 +01:00
parent e7660fda7c
commit 4c1574947f

View File

@ -80,16 +80,16 @@ app.get("/api/search", async (req, res) => {
} }
const [start, end] = [20 * page, 20 * (page + 1)]; const [start, end] = [20 * page, 20 * (page + 1)];
const withDistance = videos const withDistance = videos
.map(video => ({dist: levenshtein(search, video.title), ...video})); .map(video => ({ dist: levenshtein(search, video.title), ...video }));
withDistance.sort((a, b) => a.dist - b.dist); withDistance.sort((a, b) => a.dist - b.dist);
const returnedVideos = withDistance const returnedVideos = withDistance
.slice(start, end) .slice(start, end)
.map(video => { .map(video => {
const user = users.find(user => user.id === video.userId); const user = users.find(user => user.id === video.userId);
if (!user) { if (!user) {
return {...video, author: "[Liberal]"}; return { ...video, author: "[Liberal]" };
} }
return {...video, author: user.username}; return { ...video, author: user.username };
}); });
return res.status(200).json({ ok: true, videos: returnedVideos, total: videos.length }); return res.status(200).json({ ok: true, videos: returnedVideos, total: videos.length });
}); });
@ -143,7 +143,7 @@ app.post("/api/upload_video", authorized(), fileUpload({ limits: { fileSize: 2 *
console.log(newPath); console.log(newPath);
const exitCode = await new Promise((resolve, _reject) => { const exitCode = await new Promise((resolve, _reject) => {
const process = childProcess.spawn("HandBrakeCLI", ["-i", tempPath, "-o", newPath, "-Z", "Social 50 MB 10 Minutes 480p30"]); const process = childProcess.spawn("HandBrakeCLI", ["-i", tempPath, "-o", newPath, "-Z", "Social 25 MB 5 Minutes 360p60"]);
process.stderr.on("data", (data) => { process.stderr.on("data", (data) => {
console.error(data.toString()); console.error(data.toString());
}); });