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

@@ -13,7 +13,7 @@ function get_correct_info(song_generated, channel, broadcast) {
type: "GET",
url: "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+key+"&id=" + song_generated.id,
}, function(error, response, body) {
}, function(error, response, body, callback) {
try {
var resp = JSON.parse(body);
if(resp.items.length == 1) {
@@ -39,6 +39,9 @@ function get_correct_info(song_generated, channel, broadcast) {
if(broadcast && docs.nModified == 1) {
song_generated.new_id = song_generated.id;
io.to(channel).emit("channel", {type: "changed_values", value: song_generated});
if(callback) {
callback();
}
}
});
}