Fix spotify searches with no results

This commit is contained in:
Jonathan Cremin 2014-12-06 21:39:15 +00:00
parent 9dd87c8d18
commit 8bcb13a7a9
2 changed files with 2 additions and 4 deletions

View file

@ -69,13 +69,13 @@ module.exports.search = function(data) {
album = data.album.name;
}
spotify.search({query: query, type: type}, function(err, data) {
spotify.search({query: query, type: type}, function(err, results) {
if ( err ) {
deferred.resolve({service: "spotify"});
return;
}
if (!data[type + "s"].items[0]) {
if (!results[type + "s"].items[0]) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0] && matches[0] != album) {
var cleanedData = JSON.parse(JSON.stringify(data));