mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-25 14:10:57 +03:00
Improved arg simulation -- now uses same method as the actual download
Added checkbox for advanced custom args to either replace all args or append
This commit is contained in:
@@ -987,8 +987,9 @@ app.post('/api/downloadFile', optionalJwt, async function(req, res) {
|
||||
const url = req.body.url;
|
||||
const type = req.body.type;
|
||||
const user_uid = req.isAuthenticated() ? req.user.uid : null;
|
||||
var options = {
|
||||
const options = {
|
||||
customArgs: req.body.customArgs,
|
||||
additionalArgs: req.body.additionalArgs,
|
||||
customOutput: req.body.customOutput,
|
||||
selectedHeight: req.body.selectedHeight,
|
||||
customQualityConfiguration: req.body.customQualityConfiguration,
|
||||
@@ -996,7 +997,7 @@ app.post('/api/downloadFile', optionalJwt, async function(req, res) {
|
||||
youtubePassword: req.body.youtubePassword,
|
||||
ui_uid: req.body.ui_uid,
|
||||
cropFileSettings: req.body.cropFileSettings
|
||||
}
|
||||
};
|
||||
|
||||
const download = await downloader_api.createDownload(url, type, options, user_uid);
|
||||
|
||||
@@ -1012,6 +1013,26 @@ app.post('/api/killAllDownloads', optionalJwt, async function(req, res) {
|
||||
res.send(result_obj);
|
||||
});
|
||||
|
||||
app.post('/api/generateArgs', optionalJwt, async function(req, res) {
|
||||
const url = req.body.url;
|
||||
const type = req.body.type;
|
||||
const user_uid = req.isAuthenticated() ? req.user.uid : null;
|
||||
const options = {
|
||||
customArgs: req.body.customArgs,
|
||||
additionalArgs: req.body.additionalArgs,
|
||||
customOutput: req.body.customOutput,
|
||||
selectedHeight: req.body.selectedHeight,
|
||||
customQualityConfiguration: req.body.customQualityConfiguration,
|
||||
youtubeUsername: req.body.youtubeUsername,
|
||||
youtubePassword: req.body.youtubePassword,
|
||||
ui_uid: req.body.ui_uid,
|
||||
cropFileSettings: req.body.cropFileSettings
|
||||
};
|
||||
|
||||
const args = await downloader_api.generateArgs(url, type, options, user_uid, true);
|
||||
res.send({args: args});
|
||||
});
|
||||
|
||||
// gets all download mp3s
|
||||
app.get('/api/getMp3s', optionalJwt, async function(req, res) {
|
||||
// TODO: simplify
|
||||
|
||||
@@ -369,7 +369,7 @@ async function downloadQueuedFile(download_uid) {
|
||||
|
||||
// helper functions
|
||||
|
||||
exports.generateArgs = async (url, type, options, user_uid = null) => {
|
||||
exports.generateArgs = async (url, type, options, user_uid = null, simulated = false) => {
|
||||
const audioFolderPath = config_api.getConfigItem('ytdl_audio_folder_path');
|
||||
const videoFolderPath = config_api.getConfigItem('ytdl_video_folder_path');
|
||||
|
||||
@@ -510,7 +510,7 @@ exports.generateArgs = async (url, type, options, user_uid = null) => {
|
||||
// filter out incompatible args
|
||||
downloadConfig = filterArgs(downloadConfig, is_audio);
|
||||
|
||||
logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`);
|
||||
if (!simulated) logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`);
|
||||
return downloadConfig;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user