From 8bcb13a7a9ff1d9d751dd638a728f8174bb83693 Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Sat, 6 Dec 2014 21:39:15 +0000 Subject: [PATCH] Fix spotify searches with no results --- lib/services/itunes.js | 2 -- lib/services/spotify.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/services/itunes.js b/lib/services/itunes.js index 6b4f229..178bfa3 100644 --- a/lib/services/itunes.js +++ b/lib/services/itunes.js @@ -26,8 +26,6 @@ module.exports.lookupId = function(id, type, cc) { path = "/" + cc + path; } - console.log(path) - request.get(apiRoot + path, function(res) { var data = JSON.parse(res.text); diff --git a/lib/services/spotify.js b/lib/services/spotify.js index c4793de..fdee355 100644 --- a/lib/services/spotify.js +++ b/lib/services/spotify.js @@ -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));