mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-20 23:23:19 +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) {
|
if (err) {
|
||||||
audiopath = "-1";
|
audiopath = "-1";
|
||||||
|
console.log(err.stderr);
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
throw err;
|
throw err;
|
||||||
} else if (output) {
|
} else if (output) {
|
||||||
@@ -478,6 +479,7 @@ app.post('/tomp4', function(req, res) {
|
|||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
videopath = "-1";
|
videopath = "-1";
|
||||||
|
console.log(err.stderr);
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
throw err;
|
throw err;
|
||||||
} else if (output) {
|
} 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) => {
|
app.post('/deletePlaylist', async (req, res) => {
|
||||||
let playlistID = req.body.playlistID;
|
let playlistID = req.body.playlistID;
|
||||||
let type = req.body.type;
|
let type = req.body.type;
|
||||||
|
|||||||
Reference in New Issue
Block a user