mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-07 20:10:03 +03:00
backend playlist updating endpoint implemented
tomp3/tomp4 errors are now logged
This commit is contained in:
@@ -417,6 +417,7 @@ app.post('/tomp3', function(req, res) {
|
||||
}
|
||||
if (err) {
|
||||
audiopath = "-1";
|
||||
console.log(err.stderr);
|
||||
res.sendStatus(500);
|
||||
throw err;
|
||||
} else if (output) {
|
||||
@@ -478,6 +479,7 @@ app.post('/tomp4', function(req, res) {
|
||||
}
|
||||
if (err) {
|
||||
videopath = "-1";
|
||||
console.log(err.stderr);
|
||||
res.sendStatus(500);
|
||||
throw err;
|
||||
} else if (output) {
|
||||
@@ -661,6 +663,32 @@ app.post('/createPlaylist', async (req, res) => {
|
||||
})
|
||||
});
|
||||
|
||||
app.post('/updatePlaylist', async (req, res) => {
|
||||
let playlistID = req.body.playlistID;
|
||||
let fileNames = req.body.fileNames;
|
||||
let type = req.body.type;
|
||||
|
||||
let success = false;
|
||||
try {
|
||||
db.get(`playlists.${type}`)
|
||||
.find({id: playlistID})
|
||||
.assign({fileNames: fileNames})
|
||||
.write();
|
||||
/*console.log('success!');
|
||||
let new_val = db.get(`playlists.${type}`)
|
||||
.find({id: playlistID})
|
||||
.value();
|
||||
console.log(new_val);*/
|
||||
success = true;
|
||||
} catch(e) {
|
||||
console.error(`Failed to find playlist with ID ${playlistID}`);
|
||||
}
|
||||
|
||||
res.send({
|
||||
success: success
|
||||
})
|
||||
});
|
||||
|
||||
app.post('/deletePlaylist', async (req, res) => {
|
||||
let playlistID = req.body.playlistID;
|
||||
let type = req.body.type;
|
||||
|
||||
Reference in New Issue
Block a user