Handle non-album/track ids in GPM, 404 xbox

This commit is contained in:
Jonathan Cremin 2014-12-28 23:19:18 +00:00
parent b3ca20570e
commit 15712f9482
4 changed files with 14 additions and 3 deletions

View file

@ -28,7 +28,11 @@ module.exports.parseUrl = function(url) {
var id = parts[2];
var artist = decodeURIComponent(parts[3]);
var album = decodeURIComponent(parts[4]);
if (type != "album" && type != "track") {
return false;
}
if (id.length > 0) {
return {id: id, type: type};
} else {
@ -39,6 +43,7 @@ module.exports.parseUrl = function(url) {
var type = matches[1][0] == "T" ? "track" : "album";
return module.exports.lookupId(matches[1], type);
}
return false;
})
}
@ -105,6 +110,7 @@ module.exports.search = function(data) {
}
return pm.searchAsync(query, 5).then(function(result) {
if (!result.entries) {
var matches = album.match(/^[^\(\[]+/);
if (matches[0] && matches[0] != album) {