}
if (enableartistrules) {
- // Ignore "the" at the beginning of artist name
- if (/^the /.test(subject)) {
- var nothe = subject.replace(/^the /, '');
- if (checkDistance(nothe, guess, threshold)) {
- return true;
- }
- if (/jimi hendrix experience/.test(nothe) &&
- checkDistance(nothe.replace(/ experience/, ''), guess, threshold)) {
- return true;
- }
- }
// Split artist name on " & " and ", " (artist name can be composed by more names)
- var splitted = subject.split(/ & |, /);
- if (splitted.length !== 1) {
- for (var i=0; i<splitted.length; i++) {
- if (checkDistance(splitted[i], guess, threshold)) {
+ var splits = subject.split(/ & |, /)
+ , multipleartists = splits.length !== 1;
+ for (var i = 0; i < splits.length; i++) {
+ var artist = splits[i];
+ if (multipleartists) {
+ if (checkDistance(artist, guess, threshold)) {
+ return true;
+ }
+ if (/\./.test(artist) &&
+ checkDistance(artist.replace(/\./g, ''), guess, threshold)) {
+ return true;
+ }
+ }
+ // Ignore "the" at the beginning of artist name
+ if (/^the /.test(artist)) {
+ var nothe = artist.replace(/^the /, '');
+ if (checkDistance(nothe, guess, threshold)) {
+ return true;
+ }
+ if (/\./.test(nothe) &&
+ checkDistance(nothe.replace(/\./g, ''), guess, threshold)) {
return true;
}
- if (/^the /.test(splitted[i]) &&
- checkDistance(splitted[i].replace(/^the /, ''), guess, threshold)) {
+ if (/jimi hendrix experience/.test(nothe) &&
+ checkDistance(nothe.replace(/ experience/, ''), guess, threshold)) {
return true;
}
}
+ if (guess === 'ccr' && artist === 'creedence clearwater revival') {
+ return true;
+ }
+ if (guess === 'elo' && artist === 'electric light orchestra') {
+ return true;
+ }
+ if (guess === 'omd' && artist === 'orchestral manoeuvres in the dark') {
+ return true;
+ }
}
}
else {