Add deezer tests

This commit is contained in:
Jonathan Cremin 2014-12-04 21:00:34 +00:00
parent 066d3e2d24
commit 1b2c568ac6
2 changed files with 60 additions and 5 deletions

View file

@ -78,12 +78,10 @@ module.exports.search = function(data, next) {
module.exports.parseUrl = function(url, next) {
var deferred = Q.defer();
var matches = parse(url).path.match(/\/albums[\/]+([^\/]+)(\/tracks\/)?([^\/]+)?/);
var matches = parse(url).path.match(/\/(album|track)[\/]+([^\/]+)/);
if (matches && matches[3]) {
module.exports.lookupId(matches[3]).then(deferred.resolve);
} else if (matches && matches[1]) {
module.exports.lookupId(matches[1]).then(deferred.resolve);
if (matches && matches[2]) {
module.exports.lookupId(matches[2], matches[1]).then(deferred.resolve);
}
return deferred.promise;
}