Add support for rdio short urls

This commit is contained in:
Jonathan Cremin 2015-02-14 01:50:59 +00:00
parent e4a856e228
commit c7b9ea5b00

View file

@ -6,6 +6,7 @@ module.exports.match = function(url) {
if (!parsed.host.match(/rd\.io$/) && !parsed.host.match(/rdio\.com$/)) { if (!parsed.host.match(/rd\.io$/) && !parsed.host.match(/rdio\.com$/)) {
return false; return false;
} }
var matches = parsed.path.match(/[\/]*artist[\/]*([^\/]*)[\/]*album[\/]*([^\/]*)[\/]*([track]*)?[\/]*([^\/]*)/); var regular = parsed.path.match(/[\/]*artist[\/]*([^\/]*)[\/]*album[\/]*([^\/]*)[\/]*([track]*)?[\/]*([^\/]*)/);
return !!matches[2]; var short = parsed.path.match(/[\/]*x[\/]*([^\/]*)/);
return (regular && !!regular[2]) || (short && !!short[1]);
}; };