From 96a7ec2325857e3fe6d4f6200558825e53a5b469 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 27 Feb 2020 15:43:02 +0100 Subject: [PATCH] reverted change and rename mkv to mp4 so it plays on discord --- commands/utility/download.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/utility/download.js b/commands/utility/download.js index 914dc4b..8f45992 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -66,7 +66,7 @@ class DownloadCommand extends Command { if (err); }); } - return youtubedl.exec(link, ['--recode-video', 'mp4', '-o', `${os.tmpdir()}/${fileName}`], {}, async function(err) { + return youtubedl.exec(link, ['-o', `${os.tmpdir()}/${fileName}`], {}, async function(err) { if (err) { console.error(err); loadingmsg.delete(); @@ -74,11 +74,14 @@ class DownloadCommand extends Command { } let ext = 'mp4'; + if (fs.existsSync(`${os.tmpdir()}/${fileName}`)) { ext = await filetype.fromFile(`${os.tmpdir()}/${fileName}`); ext = ext.ext; // This look stupid but hey, it work if (ext == '3gp') ext = 'mp4'; // Change 3gp file extension to mp4 so discord show the video ( and to stop people from complaining ) fs.renameSync(`${os.tmpdir()}/${fileName}`, `${os.tmpdir()}/${fileName}.${ext}`); + } else if (fs.existsSync(`${os.tmpdir()}/${fileName}.mkv`)) { // If it can't find the video assume it got merged and end with mkv + fs.renameSync(`${os.tmpdir()}/${fileName}.mkv`, `${os.tmpdir()}/${fileName}.mp4`); // Discord play mkv just fine but it need to end with mp4 } let file = fs.statSync(`${os.tmpdir()}/${fileName}.${ext}`);