diff --git a/lib/rdio.js b/lib/rdio.js index bd62197..48606ec 100644 --- a/lib/rdio.js +++ b/lib/rdio.js @@ -81,13 +81,22 @@ module.exports.search = function(data, next) { } else if (type == "track") { query = data.artist.name + " " + data.album.name + " " + data.name; } - console.log(query) + rdio.api("", "", { query: query, method: 'search', types: type, }, function(err, results) { - var result = JSON.parse(results).result.results[0]; + var results = JSON.parse(results).result.results; + + var result = results.filter(function(result) { + if (type == "album" && result.name == data.name) { + return result; + } else if (type == "track" && result.album.name == data.album) { + return result; + } + }).shift(); + console.log(result) if (!result) { return next({}); } diff --git a/lib/spotify.js b/lib/spotify.js index 46944b7..3f575ab 100644 --- a/lib/spotify.js +++ b/lib/spotify.js @@ -58,8 +58,6 @@ module.exports.search = function(data, next) { return; } - console.log(data[type + "s"].items[1]) - var item = data[type + "s"].items[0]; module.exports.lookupId(item.id, type, next); diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 1c25dc9..4ff3160 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -18,7 +18,7 @@ header h1 a { color: #fff; } -header h1 a:hover { +header h1 a:hover, header h1 a:focus{ color: #f2c4ad; text-decoration: none; }