Fix second lookups

This commit is contained in:
Jonathan Cremin 2014-12-05 22:26:12 +00:00
parent e9a5f6713d
commit 88ae9b401c
6 changed files with 8 additions and 8 deletions

View file

@ -96,7 +96,7 @@ module.exports.search = function(data) {
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {

View file

@ -84,7 +84,7 @@ module.exports.search = function(data, next) {
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {

View file

@ -89,7 +89,7 @@ module.exports.search = function(data) {
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {

View file

@ -77,7 +77,7 @@ module.exports.search = function(data) {
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {

View file

@ -115,19 +115,19 @@ module.exports.search = function(data) {
var result = results.filter(function(result) {
if (type == "album" && result.name.match(/([^\(\[]+)/)[0] == albumClean) {
return result;
} else if (type == "track" && result.album.match(/([^\(\[]+)/)[0] == albumClean) {
} else if (type == "track" && result.album.name.match(/([^\(\[]+)/)[0] == albumClean) {
return result;
}
}).shift();
if (!result) {
var matches = albumClean.match(/^[^\(\[]+/);
if (matches[0] && matches[0] != album) {
if (matches[0] && matches[0] != albumClean) {
var cleanedData = JSON.parse(JSON.stringify(data));
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {

View file

@ -82,7 +82,7 @@ module.exports.search = function(data) {
if (type == "album") {
cleanedData.name = matches[0].trim();
} else if (type == "track") {
cleanedData.album = matches[0].trim();
cleanedData.album.name = matches[0].trim();
}
module.exports.search(cleanedData).then(deferred.resolve);
} else {