Make sure the vid is mp4

This commit is contained in:
loicbersier 2019-10-28 14:41:19 +01:00
parent 89b2460ed4
commit 57e6488b02
3 changed files with 3 additions and 4 deletions

View file

@ -56,7 +56,7 @@ class vidshittifierCommand extends Command {
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>'); let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
if (url) { if (url) {
return youtubedl.exec(url, ['--merge-output-format', 'mp4', '-o', input], {}, function(err) { return youtubedl.exec(url, ['--format=mp4', '-o', input], {}, function(err) {
if (err) { if (err) {
console.error(err); console.error(err);
loadingmsg.delete(); loadingmsg.delete();

View file

@ -63,7 +63,7 @@ class ytpCommand extends Command {
} }
if (url) { if (url) {
return youtubedl.exec(url, ['--merge-output-format', 'mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, function(err) { return youtubedl.exec(url, ['--format=mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, function(err) {
if (err) { if (err) {
console.error(err); console.error(err);
loadingmsg.delete(); loadingmsg.delete();

View file

@ -50,13 +50,12 @@ class DownloadCommand extends Command {
if (err); if (err);
}); });
} }
return youtubedl.exec(args.link, ['--merge-output-format', 'mp4', '-o', `${os.tmpdir()}/${fileName}.mp4`], {}, async function(err, output) { return youtubedl.exec(args.link, ['--format=mp4', '-o', `${os.tmpdir()}/${fileName}.mp4`], {}, async function(err) {
if (err) { if (err) {
console.error(err); console.error(err);
loadingmsg.delete(); loadingmsg.delete();
return message.channel.send('An error has occured, I can\'t download from the link you provided.'); return message.channel.send('An error has occured, I can\'t download from the link you provided.');
} }
console.log(output.join('\n'));
let file = fs.statSync(`${os.tmpdir()}/${fileName}.mp4`); let file = fs.statSync(`${os.tmpdir()}/${fileName}.mp4`);
let fileSize = file.size / 1000000.0; let fileSize = file.size / 1000000.0;