Fix second lookups
This commit is contained in:
parent
e9a5f6713d
commit
88ae9b401c
6 changed files with 8 additions and 8 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue