Added the ability to download (export) archives from subscriptions

This commit is contained in:
Isaac Grynsztein
2020-03-08 22:24:59 -04:00
parent 6f3e94cf24
commit 846dd7e250
9 changed files with 43 additions and 5 deletions

View File

@@ -192,7 +192,7 @@ function watchSubscriptions() {
let current_delay = 0;
for (let i = 0; i < subscriptions.length; i++) {
let sub = subscriptions[i];
console.log('watching ' + sub.name + ' with delay interval of ' + delay_interval);
if (debugMode) console.log('watching ' + sub.name + ' with delay interval of ' + delay_interval);
setTimeout(() => {
subscriptions_api.getVideosForSub(sub);
}, current_delay);
@@ -1145,6 +1145,20 @@ app.post('/api/deleteFile', async (req, res) => {
res.send()
});
app.post('/api/downloadArchive', async (req, res) => {
let sub = req.body.sub;
let archive_dir = sub.archive;
let full_archive_path = path.join(__dirname, archive_dir, 'archive.txt');
if (fs.existsSync(full_archive_path)) {
res.sendFile(full_archive_path);
} else {
res.sendStatus(404);
}
});
app.get('/api/video/:id', function(req , res){
var head;
let optionalParams = url_api.parse(req.url,true).query;