1
0
Fork 0

reverted change and rename mkv to mp4 so it plays on discord

akairo
loicbersier 4 years ago
parent d45e447a92
commit 96a7ec2325

@ -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}`);

Loading…
Cancel
Save