minor chages;
This commit is contained in:
@@ -202,7 +202,8 @@ class MainController extends Controller
|
||||
*/
|
||||
public function scanFolder()
|
||||
{
|
||||
$resp = folderScan::sync();
|
||||
$force = $this->request->getParam('force') ?? false;
|
||||
$resp = $force ? folderScan::create()->scan() : folderScan::sync();
|
||||
return new JSONResponse($resp);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -81,10 +81,9 @@ class YoutubeController extends Controller
|
||||
$url = trim($this->request->getParam('text-input-value'));
|
||||
$yt = $this->youtube;
|
||||
if (in_array($this->request->getParam('extension'), $this->audio_extensions)) {
|
||||
$yt->audioOnly = TRUE;
|
||||
$yt->audioOnly = true;
|
||||
$yt->audioFormat = $this->request->getParam('extension');
|
||||
} else {
|
||||
$yt->audioOnly = FALSE;
|
||||
$yt->videoFormat = $this->request->getParam('extension');
|
||||
}
|
||||
if (!$yt->isInstalled()) {
|
||||
@@ -158,10 +157,10 @@ class YoutubeController extends Controller
|
||||
if (!empty($data['link'])) {
|
||||
if (isset($data['ext'])) {
|
||||
if (in_array($data['ext'], $this->audio_extensions)) {
|
||||
$this->youtube->audioOnly = TRUE;
|
||||
$this->youtube->audioOnly = true;
|
||||
$this->youtube->audioFormat = $data['ext'];
|
||||
} else {
|
||||
$this->youtube->audioOnly = FALSE;
|
||||
$this->youtube->audioOnly = false;
|
||||
$this->youtube->videoFormat = $data['ext'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@ use Symfony\Component\Process\Process;
|
||||
|
||||
class Youtube
|
||||
{
|
||||
private $ipv4Only;
|
||||
public $audioOnly = 0;
|
||||
public $audioFormat = 'm4a', $videoFormat;
|
||||
public $audioFormat = 'm4a', $videoFormat = null;
|
||||
private $format = 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best';
|
||||
private $options = [];
|
||||
private $downloadDir;
|
||||
@@ -129,7 +128,7 @@ class Youtube
|
||||
if ($this->audioOnly) {
|
||||
$this->audioMode();
|
||||
} else {
|
||||
if ((Helper::ffmpegInstalled()) && ($this->videoFormat != "")) {
|
||||
if (Helper::ffmpegInstalled() && $this->videoFormat) {
|
||||
$this->setOption('--format', 'bestvideo+bestaudio/best');
|
||||
$this->setVideoFormat($this->videoFormat);
|
||||
} else {
|
||||
@@ -145,9 +144,9 @@ class Youtube
|
||||
$process->setTimeout($this->timeout);
|
||||
$data = ['link' => $url];
|
||||
if ($this->audioOnly) {
|
||||
$data['ext'] = $this->audioFormat;
|
||||
$data['ext'] = $this->audioFormat;
|
||||
} else {
|
||||
$data['ext'] = $this->videoFormat;
|
||||
$data['ext'] = $this->videoFormat;
|
||||
}
|
||||
$process->run(function ($type, $buffer) use ($data, $process) {
|
||||
if (Process::ERR === $type) {
|
||||
|
||||
Reference in New Issue
Block a user