Add html titles, improve youtube track matching

This commit is contained in:
Jonathan Cremin 2014-12-05 23:47:27 +00:00
parent 6decb7e8e3
commit 4d4c078220
3 changed files with 19 additions and 13 deletions

View file

@ -29,7 +29,7 @@ module.exports = function(req, res, next) {
req.db.matches.findOne({_id:serviceId + itemId}).then(function(doc) {
if (doc) {
res.render(type, {page: type, items: doc.items});
res.render(type, {page: type, title: doc.items[0].name + " by " + doc.items[0].artist.name, items: doc.items});
} else {
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
for (var id in services) {
@ -58,7 +58,7 @@ module.exports = function(req, res, next) {
items.unshift(item);
req.db.matches.save({_id:serviceId + itemId, items:items});
cache[serviceId][type + "-" + itemId] = items;
res.render(type, {page: type, items: items});
res.render(type, {page: type, title: item.name + " by " + item.artist.name, items: items});
});
}, function(error) {
if (error.code == "ETIMEDOUT") {