save download path in database
This commit is contained in:
@@ -192,8 +192,9 @@ class Aria2Controller extends Controller
|
|||||||
//internal nextcloud absolute path for nodeExists
|
//internal nextcloud absolute path for nodeExists
|
||||||
//$file = $this->userFolder . $this->downloadDir . "/" . $filename;
|
//$file = $this->userFolder . $this->downloadDir . "/" . $filename;
|
||||||
// $dir = $this->rootFolder->nodeExists($file) ? $this->downloadDir . "/" . $filename : $this->downloadDir;
|
// $dir = $this->rootFolder->nodeExists($file) ? $this->downloadDir . "/" . $filename : $this->downloadDir;
|
||||||
$file = $this->downloadDir . "/" . $filename;
|
$dlDir = $extra['path'] ?? $this->downloadDir;
|
||||||
$params = ['dir' => $this->downloadDir];
|
$file = $dlDir. "/" . $filename;
|
||||||
|
$params = ['dir' => $dlDir];
|
||||||
$fileInfo = Filesystem::getFileInfo($file);
|
$fileInfo = Filesystem::getFileInfo($file);
|
||||||
if ($fileInfo) {
|
if ($fileInfo) {
|
||||||
$fileType = $fileInfo->getType();
|
$fileType = $fileInfo->getType();
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class MainController extends Controller
|
|||||||
'type' => Helper::DOWNLOADTYPE['ARIA2'],
|
'type' => Helper::DOWNLOADTYPE['ARIA2'],
|
||||||
'filename' => empty($filename) ? "unknown" : $filename,
|
'filename' => empty($filename) ? "unknown" : $filename,
|
||||||
'timestamp' => time(),
|
'timestamp' => time(),
|
||||||
'data' => serialize(['link' => $url]),
|
'data' => serialize(['link' => $url,'path' => Helper::getDownloadDir()]),
|
||||||
];
|
];
|
||||||
$this->dbconn->save($data);
|
$this->dbconn->save($data);
|
||||||
$resp = ['message' => $filename, 'result' => $result, 'file' => $filename];
|
$resp = ['message' => $filename, 'result' => $result, 'file' => $filename];
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class YoutubeController extends Controller
|
|||||||
}
|
}
|
||||||
$resp['title'] = [];
|
$resp['title'] = [];
|
||||||
$resp['row'] = [];
|
$resp['row'] = [];
|
||||||
$params = ['dir' => $this->downloadDir];
|
$params = ['dir' => $data['path'] ?? $this->downloadDir];
|
||||||
$folderLink = $this->urlGenerator->linkToRoute('files.view.index', $params);
|
$folderLink = $this->urlGenerator->linkToRoute('files.view.index', $params);
|
||||||
foreach ($data as $value) {
|
foreach ($data as $value) {
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
@@ -92,7 +92,7 @@ class YoutubeController extends Controller
|
|||||||
if (Helper::isGetUrlSite($url)) {
|
if (Helper::isGetUrlSite($url)) {
|
||||||
return new JSONResponse($this->downloadUrlSite($url));
|
return new JSONResponse($this->downloadUrlSite($url));
|
||||||
}
|
}
|
||||||
|
$yt->dbDlPath = Helper::getDownloadDir();
|
||||||
$resp = $yt->forceIPV4()->download($url);
|
$resp = $yt->forceIPV4()->download($url);
|
||||||
folderScan::sync();
|
folderScan::sync();
|
||||||
return new JSONResponse($resp);
|
return new JSONResponse($resp);
|
||||||
@@ -165,6 +165,7 @@ class YoutubeController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$this->dbconn->deleteByGid($gid);
|
//$this->dbconn->deleteByGid($gid);
|
||||||
|
$this->youtube->dbDlPath = Helper::getDownloadDir();
|
||||||
$resp = $this->youtube->forceIPV4()->download($data['link']);
|
$resp = $this->youtube->forceIPV4()->download($data['link']);
|
||||||
folderScan::sync();
|
folderScan::sync();
|
||||||
return new JSONResponse($resp);
|
return new JSONResponse($resp);
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ class Youtube
|
|||||||
{
|
{
|
||||||
public $audioOnly = 0;
|
public $audioOnly = 0;
|
||||||
public $audioFormat = 'm4a', $videoFormat = null;
|
public $audioFormat = 'm4a', $videoFormat = null;
|
||||||
|
//path in nextcloud fs
|
||||||
|
public $dbDlPath = 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;
|
||||||
@@ -142,7 +144,7 @@ class Youtube
|
|||||||
$this->prependOption($this->bin);
|
$this->prependOption($this->bin);
|
||||||
$process = new Process($this->options, null, $this->env);
|
$process = new Process($this->options, null, $this->env);
|
||||||
$process->setTimeout($this->timeout);
|
$process->setTimeout($this->timeout);
|
||||||
$data = ['link' => $url];
|
$data = ['link' => $url,'path' => $this->dbDlPath];
|
||||||
if ($this->audioOnly) {
|
if ($this->audioOnly) {
|
||||||
$data['ext'] = $this->audioFormat;
|
$data['ext'] = $this->audioFormat;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export default {
|
|||||||
}
|
}
|
||||||
let data = { ncd_downloader_dir: path };
|
let data = { ncd_downloader_dir: path };
|
||||||
let url = helper.generateUrl("/apps/ncdownloader/personal/save");
|
let url = helper.generateUrl("/apps/ncdownloader/personal/save");
|
||||||
helper.httpClient(url)
|
helper
|
||||||
|
.httpClient(url)
|
||||||
.setData(data)
|
.setData(data)
|
||||||
.setHandler((data) => {
|
.setHandler((data) => {
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
@@ -31,7 +32,10 @@ export default {
|
|||||||
})
|
})
|
||||||
.send();
|
.send();
|
||||||
};
|
};
|
||||||
helper.filepicker(cb);
|
let dlPath = element.hasAttribute("data-path")
|
||||||
|
? element.getAttribute("data-path")
|
||||||
|
: undefined;
|
||||||
|
helper.filepicker(cb, dlPath);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
props: ["path"],
|
props: ["path"],
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import aria2Options from './utils/aria2Options';
|
|||||||
import { options as ytdFullOptions, names as ytdOptions } from './utils/youtubedlOptions';
|
import { options as ytdFullOptions, names as ytdOptions } from './utils/youtubedlOptions';
|
||||||
import helper from './utils/helper';
|
import helper from './utils/helper';
|
||||||
import './css/autoComplete.css'
|
import './css/autoComplete.css'
|
||||||
|
import './css/settings.scss'
|
||||||
'use strict';
|
'use strict';
|
||||||
import { delegate } from 'tippy.js';
|
import { delegate } from 'tippy.js';
|
||||||
import 'tippy.js/dist/tippy.css';
|
import 'tippy.js/dist/tippy.css';
|
||||||
|
|||||||
@@ -287,13 +287,15 @@ const helper = {
|
|||||||
container.setAttribute("type", name);
|
container.setAttribute("type", name);
|
||||||
container.className = "table " + name;
|
container.className = "table " + name;
|
||||||
},
|
},
|
||||||
filepicker(cb) {
|
filepicker(cb,currentPath) {
|
||||||
OC.dialogs.filepicker(
|
OC.dialogs.filepicker(
|
||||||
t('ncdownloader', 'Select a directory'),
|
t('ncdownloader', 'Select a directory'),
|
||||||
cb,
|
cb,
|
||||||
false,
|
false,
|
||||||
'httpd/unix-directory',
|
'httpd/unix-directory',
|
||||||
true
|
true,
|
||||||
|
OC.dialogs.FILEPICKER_TYPE_CHOOSE,
|
||||||
|
currentPath
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getSettings(key, defaultValue = null, type = 2) {
|
getSettings(key, defaultValue = null, type = 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user