From e9a5f6713d9a617dfcb9ab82824baeb027b6aa75 Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Fri, 5 Dec 2014 22:20:17 +0000 Subject: [PATCH] Don't be so dumb --- lib/services/beats.js | 2 +- lib/services/deezer.js | 2 +- lib/services/googleplaymusic.js | 2 +- lib/services/itunes.js | 2 +- lib/services/rdio.js | 2 +- lib/services/spotify.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/services/beats.js b/lib/services/beats.js index b5cd57c..93bf9e0 100644 --- a/lib/services/beats.js +++ b/lib/services/beats.js @@ -91,7 +91,7 @@ module.exports.search = function(data) { request.get(apiRoot + path, function(res) { if (!res.body.data[0]) { var matches = album.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim(); diff --git a/lib/services/deezer.js b/lib/services/deezer.js index d329289..d1db89a 100644 --- a/lib/services/deezer.js +++ b/lib/services/deezer.js @@ -79,7 +79,7 @@ module.exports.search = function(data, next) { request.get(apiRoot + path, function(res) { if (!res.body.data[0]) { var matches = album.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim(); diff --git a/lib/services/googleplaymusic.js b/lib/services/googleplaymusic.js index 16f5a7c..11194a0 100644 --- a/lib/services/googleplaymusic.js +++ b/lib/services/googleplaymusic.js @@ -84,7 +84,7 @@ module.exports.search = function(data) { pm.search(query, 5, function(result) { if (!result.entries) { var matches = album.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim(); diff --git a/lib/services/itunes.js b/lib/services/itunes.js index 4f4fd0a..b1cda6d 100644 --- a/lib/services/itunes.js +++ b/lib/services/itunes.js @@ -72,7 +72,7 @@ module.exports.search = function(data) { if (!result.results[0]) { var matches = album.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim(); diff --git a/lib/services/rdio.js b/lib/services/rdio.js index 4da6503..bc87493 100644 --- a/lib/services/rdio.js +++ b/lib/services/rdio.js @@ -122,7 +122,7 @@ module.exports.search = function(data) { if (!result) { var matches = albumClean.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim(); diff --git a/lib/services/spotify.js b/lib/services/spotify.js index 966e441..4ff7123 100644 --- a/lib/services/spotify.js +++ b/lib/services/spotify.js @@ -77,7 +77,7 @@ module.exports.search = function(data) { if (!data[type + "s"].items[0]) { var matches = album.match(/^[^\(\[]+/); - if (matches[0]) { + if (matches[0] && matches[0] != album) { var cleanedData = JSON.parse(JSON.stringify(data)); if (type == "album") { cleanedData.name = matches[0].trim();