Add youtube-dl extension format select

This commit is contained in:
Moahmed-Ismail MEJRI
2022-03-16 17:20:51 +01:00
parent 7de95084be
commit 2c171152b2
4 changed files with 56 additions and 15 deletions

View File

@@ -80,6 +80,11 @@ class YoutubeController extends Controller
$url = trim($this->request->getParam('text-input-value'));
$yt = $this->youtube;
$yt->audioOnly = (bool) $this->request->getParam('audio-only');
if ($yt->audioOnly) {
$yt->audioFormat = $this->request->getParam('extension');
} else {
$yt->videoFormat = $this->request->getParam('extension');
}
if (!$yt->isInstalled()) {
return new JSONResponse(["error" => "Please install the latest youtube-dl or make the bundled binary file executable in ncdownloader/bin"]);
}