diff --git a/bot/Commands/Youtubedl.php b/bot/Commands/Youtubedl.php index e170924..1b91110 100644 --- a/bot/Commands/Youtubedl.php +++ b/bot/Commands/Youtubedl.php @@ -16,7 +16,7 @@ class Youtubedl implements Icommands $bot->replyPolitely('L\'url n\'est pas conforme'); } - if (!in_array($type, ['', 'audio', 'video'], true)) { + if (!in_array($type, ['', 'audio', 'video', 'vidéo'], true)) { $bot->replyPolitely('Je n\'ai pas compris ce que je devais faire'); } @@ -24,10 +24,14 @@ class Youtubedl implements Icommands if (in_array($type, ['', 'audio'], true)) { $type = 'l\'audio'; - exec(sprintf('%s --extract-audio --audio-format mp3 -o %s%s %s &> /dev/null &', $youtubedl, static::getDownloadFolder($bot), '%(upload_date)s-%(uploader)s-%(title)s.%(ext)s', $url)); + $cmd = sprintf('%s --extract-audio --audio-format mp3 -o %s%s %s', $youtubedl, static::getDownloadFolder($bot), '%(upload_date)s-%(uploader)s-%(title)s.%(ext)s', $url); + exec($cmd, $output); + $bot->sendChatMessage('', sprintf('Je lance %s', $cmd)); } else { $type = 'la vidéo'; - exec(sprintf('%s -f bestvideo+bestaudio/best -o %s%s %s &> /dev/null &', $youtubedl, static::getDownloadFolder($bot), '%(upload_date)s-%(uploader)s-%(title)s.%(ext)s', $url)); + $cmd = sprintf('%s -f bestvideo+bestaudio/best -o %s%s %s', $youtubedl, static::getDownloadFolder($bot), '%(upload_date)s-%(uploader)s-%(title)s.%(ext)s', $url); + exec($cmd, $output); + $bot->sendChatMessage('', sprintf('Je lance %s', $cmd)); } $bot->replyPolitely(sprintf('Je %s %s', $action, $type)); }