Improve Beats searches massively, increase timeout because it is slow as balls

This commit is contained in:
Jonathan Cremin 2014-12-11 21:51:14 +00:00
parent ce3ff0442c
commit 2d9f8d1b6a
3 changed files with 5 additions and 3 deletions

View file

@ -100,10 +100,10 @@ module.exports.search = function(data) {
var type = data.type;
if (type == "album") {
query = data.artist.name + " " + data.name;
query = '"' + data.artist.name + '" "' + data.name + '"';
album = data.name;
} else if (type == "track") {
query = data.artist.name + " " + data.album.name + " " + data.name;
query = '"' + data.artist.name + '" "' + data.name + '"';
album = data.album.name
}
@ -123,6 +123,8 @@ module.exports.search = function(data) {
deferred.resolve({service: "beats"});
}
} else {
//insist on at least album or artist name being exactly right
module.exports.lookupId(res.body.data[0].id, type).then(deferred.resolve);
}
});

View file

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Before After
Before After

View file

@ -36,7 +36,7 @@ module.exports = function(req, res, next) {
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
for (var id in services) {
if (id != serviceId) {
promises.push(Q.timeout(services[id].search(item), 5000));
promises.push(Q.timeout(services[id].search(item), 10000));
}
}