Fix issue with local tracks in dups detection

This commit is contained in:
Gabriel Augendre 2016-08-09 13:11:43 +02:00
parent fb88a5ea9b
commit db877d302c
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1

View file

@ -200,8 +200,6 @@ app.get('/pl/:uId/:plId', function (req, res) {
}
i++;
}
array.forEach(function (other, otherIndex) {
});
});
res.send({
'data': dups
@ -211,7 +209,7 @@ app.get('/pl/:uId/:plId', function (req, res) {
/**
* @typedef {Object} track
* @property {number} id
* @property {number|null} id
* @property {string} name
* @property {[artist]} artists
*/
@ -231,14 +229,14 @@ app.get('/pl/:uId/:plId', function (req, res) {
function areDups(track1, track2) {
var name1 = track1.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;
}
else if (haveCommonArtist(track1, track2)) {
if (name1 == name2) {
return true;
}
else if (name1.includes(name2) || name2.includes(name1)) {
else if (name1.startsWith(name2) || name2.startsWith(name1)) {
return true;
}
}