reverted change and rename mkv to mp4 so it plays on discord
This commit is contained in:
parent
d45e447a92
commit
96a7ec2325
1 changed files with 4 additions and 1 deletions
|
@ -66,7 +66,7 @@ class DownloadCommand extends Command {
|
||||||
if (err);
|
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) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
|
@ -74,11 +74,14 @@ class DownloadCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
let ext = 'mp4';
|
let ext = 'mp4';
|
||||||
|
|
||||||
if (fs.existsSync(`${os.tmpdir()}/${fileName}`)) {
|
if (fs.existsSync(`${os.tmpdir()}/${fileName}`)) {
|
||||||
ext = await filetype.fromFile(`${os.tmpdir()}/${fileName}`);
|
ext = await filetype.fromFile(`${os.tmpdir()}/${fileName}`);
|
||||||
ext = ext.ext; // This look stupid but hey, it work
|
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 )
|
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}`);
|
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}`);
|
let file = fs.statSync(`${os.tmpdir()}/${fileName}.${ext}`);
|
||||||
|
|
Loading…
Reference in a new issue