Validating song-info on add by api

This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-01 16:14:24 +01:00
parent c6ec847306
commit 557bc521a5
2 changed files with 12 additions and 6 deletions

View File

@@ -437,8 +437,9 @@ router.route('/api/list/:channel_name/:video_id').post(function(req,res) {
});
function postEnd(channel_name, configs, new_song, guid, res) {
io.to(channel_name).emit("conf", configs);
io.to(channel_name).emit("channel", {type: "added", value: new_song});
if(configs != undefined) {
io.to(channel_name).emit("conf", configs);
}
List.getNextSong(channel_name, function() {
db.collection("timeout_api").update({type: "POST", guid: guid}, {
$set: {
@@ -447,9 +448,11 @@ function postEnd(channel_name, configs, new_song, guid, res) {
guid: guid,
},
}, {upsert: true}, function(err, docs) {
res.header({'Content-Type': 'application/json'});
res.status(200).send(JSON.stringify(new_song));
return;
Search.get_correct_info(new_song, channel_name, !new_song.now_playing, function() {
res.header({'Content-Type': 'application/json'});
res.status(200).send(JSON.stringify(new_song));
return;
});
});
});
}