Improve spotify matching
This commit is contained in:
parent
d6352b6250
commit
c5ea8f5b7a
2 changed files with 7 additions and 1 deletions
|
@ -86,6 +86,7 @@ export function* search(data) {
|
|||
}
|
||||
|
||||
const results = yield spotify.searchAsync({query: query, type: type});
|
||||
|
||||
if (!results[type + "s"].items[0]) {
|
||||
return {service: "spotify"};
|
||||
} else {
|
||||
|
@ -97,7 +98,7 @@ export function* search(data) {
|
|||
|
||||
results[type + "s"].items.forEach(function(item) {
|
||||
const albumName = data.type == "album" ? item.name : item.album.name;
|
||||
const matches = albumName.match(/^[^\(\[]+/);
|
||||
const matches = cleanParam(albumName).match(/^[^\(\[]+/);
|
||||
if(choppedAlbum.indexOf(matches[0]) >= 0) {
|
||||
found = item;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,11 @@ describe('Spotify', function(){
|
|||
const result = yield spotify.search({type: 'album', artist: {name: 'David Guetta'}, name: 'Listen (Deluxe)'});
|
||||
result.name.should.equal('Listen (Deluxe)');
|
||||
});
|
||||
|
||||
it('should find album with colon in name by search', function* (){
|
||||
const result = yield spotify.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Get Down Part II: Original Soundtrack From The Netflix Original Series'});
|
||||
result.name.should.equal('The Get Down Part II: Original Soundtrack From The Netflix Original Series');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseUrl', function(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue