minor chages;
This commit is contained in:
@@ -8,7 +8,7 @@ return [
|
|||||||
['name' => 'main#Download', 'url' => '/new', 'verb' => 'POST'],
|
['name' => 'main#Download', 'url' => '/new', 'verb' => 'POST'],
|
||||||
['name' => 'Aria2#Action', 'url' => '/aria2/{path}', 'verb' => 'POST'],
|
['name' => 'Aria2#Action', 'url' => '/aria2/{path}', 'verb' => 'POST'],
|
||||||
['name' => 'Aria2#getStatus', 'url' => '/status/{path}', 'verb' => 'POST'],
|
['name' => 'Aria2#getStatus', 'url' => '/status/{path}', 'verb' => 'POST'],
|
||||||
['name' => 'Main#scanFolder', 'url' => '/scanfolder', 'verb' => 'GET'],
|
['name' => 'Main#scanFolder', 'url' => '/scanfolder', 'verb' => 'POST'],
|
||||||
['name' => 'Youtube#Index', 'url' => '/youtube/get', 'verb' => 'POST'],
|
['name' => 'Youtube#Index', 'url' => '/youtube/get', 'verb' => 'POST'],
|
||||||
['name' => 'Youtube#Download', 'url' => '/youtube/new', 'verb' => 'POST'],
|
['name' => 'Youtube#Download', 'url' => '/youtube/new', 'verb' => 'POST'],
|
||||||
['name' => 'Youtube#Delete', 'url' => '/youtube/delete', 'verb' => 'POST'],
|
['name' => 'Youtube#Delete', 'url' => '/youtube/delete', 'verb' => 'POST'],
|
||||||
|
|||||||
@@ -202,7 +202,8 @@ class MainController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function scanFolder()
|
public function scanFolder()
|
||||||
{
|
{
|
||||||
$resp = folderScan::sync();
|
$force = $this->request->getParam('force') ?? false;
|
||||||
|
$resp = $force ? folderScan::create()->scan() : folderScan::sync();
|
||||||
return new JSONResponse($resp);
|
return new JSONResponse($resp);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -81,10 +81,9 @@ class YoutubeController extends Controller
|
|||||||
$url = trim($this->request->getParam('text-input-value'));
|
$url = trim($this->request->getParam('text-input-value'));
|
||||||
$yt = $this->youtube;
|
$yt = $this->youtube;
|
||||||
if (in_array($this->request->getParam('extension'), $this->audio_extensions)) {
|
if (in_array($this->request->getParam('extension'), $this->audio_extensions)) {
|
||||||
$yt->audioOnly = TRUE;
|
$yt->audioOnly = true;
|
||||||
$yt->audioFormat = $this->request->getParam('extension');
|
$yt->audioFormat = $this->request->getParam('extension');
|
||||||
} else {
|
} else {
|
||||||
$yt->audioOnly = FALSE;
|
|
||||||
$yt->videoFormat = $this->request->getParam('extension');
|
$yt->videoFormat = $this->request->getParam('extension');
|
||||||
}
|
}
|
||||||
if (!$yt->isInstalled()) {
|
if (!$yt->isInstalled()) {
|
||||||
@@ -158,10 +157,10 @@ class YoutubeController extends Controller
|
|||||||
if (!empty($data['link'])) {
|
if (!empty($data['link'])) {
|
||||||
if (isset($data['ext'])) {
|
if (isset($data['ext'])) {
|
||||||
if (in_array($data['ext'], $this->audio_extensions)) {
|
if (in_array($data['ext'], $this->audio_extensions)) {
|
||||||
$this->youtube->audioOnly = TRUE;
|
$this->youtube->audioOnly = true;
|
||||||
$this->youtube->audioFormat = $data['ext'];
|
$this->youtube->audioFormat = $data['ext'];
|
||||||
} else {
|
} else {
|
||||||
$this->youtube->audioOnly = FALSE;
|
$this->youtube->audioOnly = false;
|
||||||
$this->youtube->videoFormat = $data['ext'];
|
$this->youtube->videoFormat = $data['ext'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ use Symfony\Component\Process\Process;
|
|||||||
|
|
||||||
class Youtube
|
class Youtube
|
||||||
{
|
{
|
||||||
private $ipv4Only;
|
|
||||||
public $audioOnly = 0;
|
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 $format = 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best';
|
||||||
private $options = [];
|
private $options = [];
|
||||||
private $downloadDir;
|
private $downloadDir;
|
||||||
@@ -129,7 +128,7 @@ class Youtube
|
|||||||
if ($this->audioOnly) {
|
if ($this->audioOnly) {
|
||||||
$this->audioMode();
|
$this->audioMode();
|
||||||
} else {
|
} else {
|
||||||
if ((Helper::ffmpegInstalled()) && ($this->videoFormat != "")) {
|
if (Helper::ffmpegInstalled() && $this->videoFormat) {
|
||||||
$this->setOption('--format', 'bestvideo+bestaudio/best');
|
$this->setOption('--format', 'bestvideo+bestaudio/best');
|
||||||
$this->setVideoFormat($this->videoFormat);
|
$this->setVideoFormat($this->videoFormat);
|
||||||
} else {
|
} else {
|
||||||
@@ -145,9 +144,9 @@ class Youtube
|
|||||||
$process->setTimeout($this->timeout);
|
$process->setTimeout($this->timeout);
|
||||||
$data = ['link' => $url];
|
$data = ['link' => $url];
|
||||||
if ($this->audioOnly) {
|
if ($this->audioOnly) {
|
||||||
$data['ext'] = $this->audioFormat;
|
$data['ext'] = $this->audioFormat;
|
||||||
} else {
|
} else {
|
||||||
$data['ext'] = $this->videoFormat;
|
$data['ext'] = $this->videoFormat;
|
||||||
}
|
}
|
||||||
$process->run(function ($type, $buffer) use ($data, $process) {
|
$process->run(function ($type, $buffer) use ($data, $process) {
|
||||||
if (Process::ERR === $type) {
|
if (Process::ERR === $type) {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export default {
|
|||||||
let formWrapper = element.closest("form");
|
let formWrapper = element.closest("form");
|
||||||
let formData = helper.getData(formWrapper);
|
let formData = helper.getData(formWrapper);
|
||||||
let inputValue = formData["text-input-value"];
|
let inputValue = formData["text-input-value"];
|
||||||
if (inputValue && inputValue.length < 2) {
|
if (!inputValue || (inputValue && inputValue.length < 2)) {
|
||||||
helper.error(t("ncdownloader", "Please enter valid keyword!"));
|
helper.error(t("ncdownloader", "Please enter valid keyword!"));
|
||||||
vm.$data.loading = 0;
|
vm.$data.loading = 0;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ const buttonHandler = (event, type) => {
|
|||||||
let url = element.getAttribute("path");
|
let url = element.getAttribute("path");
|
||||||
let row, data = {};
|
let row, data = {};
|
||||||
let removeRow = true;
|
let removeRow = true;
|
||||||
if (element.getAttribute("id") == "download-action-button"){
|
if (element.getAttribute("id") == "download-action-button") {
|
||||||
helper.getCounters();
|
helper.loop(helper.getCounters);
|
||||||
|
helper.setContentTableType("search-results");
|
||||||
}
|
}
|
||||||
if (row = element.closest('.table-row-search')) {
|
if (row = element.closest('.table-row-search')) {
|
||||||
if (element.className == 'icon-clipboard') {
|
if (element.className == 'icon-clipboard') {
|
||||||
|
|||||||
@@ -81,8 +81,6 @@ window.addEventListener('DOMContentLoaded', function () {
|
|||||||
delegate('#app-ncdownloader-wrapper',
|
delegate('#app-ncdownloader-wrapper',
|
||||||
{ target: '[data-tippy-content]' }
|
{ target: '[data-tippy-content]' }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ const helper = {
|
|||||||
return helper.vue[name];
|
return helper.vue[name];
|
||||||
},
|
},
|
||||||
generateUrl: generateUrl,
|
generateUrl: generateUrl,
|
||||||
|
loop(callback, delay = 3000, ...args) {
|
||||||
|
Polling.create().setDelay(delay).run(callback, ...args);
|
||||||
|
},
|
||||||
isPolling() {
|
isPolling() {
|
||||||
return Polling.create().isEnabled();
|
return Polling.create().isEnabled();
|
||||||
},
|
},
|
||||||
@@ -28,10 +31,10 @@ const helper = {
|
|||||||
polling(delay = 1500, path) {
|
polling(delay = 1500, path) {
|
||||||
Polling.create().setDelay(delay).run(helper.refresh, path);
|
Polling.create().setDelay(delay).run(helper.refresh, path);
|
||||||
},
|
},
|
||||||
scanFolder(path = "/apps/ncdownloader/scanfolder") {
|
scanFolder(forceScan = false, path = "/apps/ncdownloader/scanfolder") {
|
||||||
let url = helper.generateUrl(path);
|
let url = helper.generateUrl(path);
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
Http.getInstance(url).setMethod('GET').setHandler(function (data) {
|
Http.getInstance(url).setData({ "force": forceScan }).setHandler(function (data) {
|
||||||
resolve(data.status);
|
resolve(data.status);
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user