Improve Beats searches massively, increase timeout because it is slow as balls
This commit is contained in:
parent
ce3ff0442c
commit
2d9f8d1b6a
3 changed files with 5 additions and 3 deletions
|
@ -100,10 +100,10 @@ module.exports.search = function(data) {
|
||||||
var type = data.type;
|
var type = data.type;
|
||||||
|
|
||||||
if (type == "album") {
|
if (type == "album") {
|
||||||
query = data.artist.name + " " + data.name;
|
query = '"' + data.artist.name + '" "' + data.name + '"';
|
||||||
album = data.name;
|
album = data.name;
|
||||||
} else if (type == "track") {
|
} else if (type == "track") {
|
||||||
query = data.artist.name + " " + data.album.name + " " + data.name;
|
query = '"' + data.artist.name + '" "' + data.name + '"';
|
||||||
album = data.album.name
|
album = data.album.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,8 @@ module.exports.search = function(data) {
|
||||||
deferred.resolve({service: "beats"});
|
deferred.resolve({service: "beats"});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//insist on at least album or artist name being exactly right
|
||||||
|
|
||||||
module.exports.lookupId(res.body.data[0].id, type).then(deferred.resolve);
|
module.exports.lookupId(res.body.data[0].id, type).then(deferred.resolve);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
|
@ -36,7 +36,7 @@ module.exports = function(req, res, next) {
|
||||||
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
|
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
|
||||||
for (var id in services) {
|
for (var id in services) {
|
||||||
if (id != serviceId) {
|
if (id != serviceId) {
|
||||||
promises.push(Q.timeout(services[id].search(item), 5000));
|
promises.push(Q.timeout(services[id].search(item), 10000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue