Fixed issue with correct title not returning result

This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-03 12:12:32 +01:00
parent fa7071ecb6
commit 740cf021f8
2 changed files with 12 additions and 5 deletions

View File

@@ -45,16 +45,24 @@ function get_correct_info(song_generated, channel, broadcast, callback) {
io.to(channel).emit("channel", {type: "changed_values", value: song_generated});
}
} else {
if(typeof(callback) == "function") {
callback(song_generated, true);
}
}
});
} else {
if(typeof(callback) == "function") {
callback(song_generated, true);
}
}
} else {
findSimilar(song_generated, channel, broadcast, callback)
}
} catch(e){
if(typeof(callback) == "function") {
callback({}, false);
}
}
});
}
@@ -123,7 +131,7 @@ function findSimilar(msg, channel, broadcast, callback) {
io.to(channel).emit("channel", {type: "changed_values", value: element});
}
}
if(callback) {
if(typeof(callback) == "function") {
msg.title = element.title;
msg.id = element.id;
msg.duration = element.duration;
@@ -132,7 +140,7 @@ function findSimilar(msg, channel, broadcast, callback) {
callback(msg, true);
}
});
} else if(callback) {
} else if(typeof(callback) == "function") {
callback({}, false);
}
});

View File

@@ -381,7 +381,6 @@ router.route('/api/list/:channel_name/:video_id').post(function(req,res) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header({"Content-Type": "application/json"});
var fetch_only = false;
if(req.body.hasOwnProperty('fetch_song')) {
fetch_only = true;