mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-09 06:41:29 +03:00
added download only mode that simply downloads files to the client when the server finishes the download
added dependency on savefile library for download-only mode
This commit is contained in:
@@ -255,9 +255,7 @@ app.post('/fileStatusMp4', function(req, res) {
|
||||
var fullpath = videoPath + name + ".mp4";
|
||||
if (fs.existsSync(fullpath)) {
|
||||
exists = [basePath + videoPath + name, getFileSizeMp4(name)];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var percent = 0;
|
||||
var size = getFileSizeMp4(name);
|
||||
var downloaded = getAmountDownloadedMp4(name);
|
||||
@@ -386,6 +384,19 @@ app.post('/deleteMp4', function(req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/downloadFile', function(req, res) {
|
||||
let fileName = req.body.fileName;
|
||||
let type = req.body.type;
|
||||
let file = null;
|
||||
if (type === 'audio') {
|
||||
file = __dirname + '/' + 'audio/' + fileName + '.mp3';
|
||||
} else if (type === 'video') {
|
||||
file = __dirname + '/' + 'video/' + fileName + '.mp4';
|
||||
}
|
||||
|
||||
res.sendFile(file);
|
||||
});
|
||||
|
||||
|
||||
app.get('/video/:id', function(req , res){
|
||||
var head;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
},
|
||||
"Extra": {
|
||||
"title_top": "Youtube Downloader",
|
||||
"file_manager_enabled": true
|
||||
"download_only_mode": false,
|
||||
"file_manager_enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user