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") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -84,7 +84,7 @@ module.exports.search = function(data, next) {
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -89,7 +89,7 @@ module.exports.search = function(data) {
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -77,7 +77,7 @@ module.exports.search = function(data) {
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -115,19 +115,19 @@ module.exports.search = function(data) {
|
||||||
var result = results.filter(function(result) {
|
var result = results.filter(function(result) {
|
||||||
if (type == "album" && result.name.match(/([^\(\[]+)/)[0] == albumClean) {
|
if (type == "album" && result.name.match(/([^\(\[]+)/)[0] == albumClean) {
|
||||||
return result;
|
return result;
|
||||||
} else if (type == "track" && result.album.match(/([^\(\[]+)/)[0] == albumClean) {
|
} else if (type == "track" && result.album.name.match(/([^\(\[]+)/)[0] == albumClean) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}).shift();
|
}).shift();
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
var matches = albumClean.match(/^[^\(\[]+/);
|
var matches = albumClean.match(/^[^\(\[]+/);
|
||||||
if (matches[0] && matches[0] != album) {
|
if (matches[0] && matches[0] != albumClean) {
|
||||||
var cleanedData = JSON.parse(JSON.stringify(data));
|
var cleanedData = JSON.parse(JSON.stringify(data));
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -82,7 +82,7 @@ module.exports.search = function(data) {
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
cleanedData.name = matches[0].trim();
|
cleanedData.name = matches[0].trim();
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
cleanedData.album = matches[0].trim();
|
cleanedData.album.name = matches[0].trim();
|
||||||
}
|
}
|
||||||
module.exports.search(cleanedData).then(deferred.resolve);
|
module.exports.search(cleanedData).then(deferred.resolve);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue