Fix issue with local tracks in dups detection
This commit is contained in:
parent
fb88a5ea9b
commit
db877d302c
1 changed files with 3 additions and 5 deletions
|
@ -200,8 +200,6 @@ app.get('/pl/:uId/:plId', function (req, res) {
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
array.forEach(function (other, otherIndex) {
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
res.send({
|
res.send({
|
||||||
'data': dups
|
'data': dups
|
||||||
|
@ -211,7 +209,7 @@ app.get('/pl/:uId/:plId', function (req, res) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} track
|
* @typedef {Object} track
|
||||||
* @property {number} id
|
* @property {number|null} id
|
||||||
* @property {string} name
|
* @property {string} name
|
||||||
* @property {[artist]} artists
|
* @property {[artist]} artists
|
||||||
*/
|
*/
|
||||||
|
@ -231,14 +229,14 @@ app.get('/pl/:uId/:plId', function (req, res) {
|
||||||
function areDups(track1, track2) {
|
function areDups(track1, track2) {
|
||||||
var name1 = track1.name.toLowerCase();
|
var name1 = track1.name.toLowerCase();
|
||||||
var name2 = track2.name.toLowerCase();
|
var name2 = track2.name.toLowerCase();
|
||||||
if (track1.id == track2.id) {
|
if (track1.id != null && track2.id != null && track1.id == track2.id) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (haveCommonArtist(track1, track2)) {
|
else if (haveCommonArtist(track1, track2)) {
|
||||||
if (name1 == name2) {
|
if (name1 == name2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (name1.includes(name2) || name2.includes(name1)) {
|
else if (name1.startsWith(name2) || name2.startsWith(name1)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue