diff --git a/src/backend/scrobblers/AbstractScrobbleClient.ts b/src/backend/scrobblers/AbstractScrobbleClient.ts index 519acb70..725250b8 100644 --- a/src/backend/scrobblers/AbstractScrobbleClient.ts +++ b/src/backend/scrobblers/AbstractScrobbleClient.ts @@ -294,7 +294,7 @@ export default abstract class AbstractScrobbleClient implements Authenticatable // return early if we don't care about checking existing if (false === this.checkExistingScrobbles) { if (this.verboseOptions.match.onNoMatch) { - this.logger.debug(`(Existing Check) Source: ${buildTrackString(playObj, scoreTrackOpts)} => No Match because existing scrobble check is FALSE`); + this.logger.debug(`${capitalize(playObj.meta.source ?? 'Source')}: ${buildTrackString(playObj, scoreTrackOpts)} => No Match because existing scrobble check is FALSE`, {leaf: ['Dupe Check']}); } return undefined; } @@ -325,7 +325,7 @@ export default abstract class AbstractScrobbleClient implements Authenticatable // (either user doesnt want to check history or there is no history to check!) if (this.recentScrobbles.length === 0) { if (this.verboseOptions.match.onNoMatch) { - this.logger.debug(`(Existing Check) ${buildTrackString(playObj, scoreTrackOpts)} => No Match because no recent scrobbles returned from API`); + this.logger.debug(`${buildTrackString(playObj, scoreTrackOpts)} => No Match because no recent scrobbles returned from API`, {leaf: ['Dupe Check']}); } return undefined; } @@ -410,10 +410,10 @@ export default abstract class AbstractScrobbleClient implements Authenticatable if ((existingScrobble !== undefined && this.verboseOptions.match.onMatch) || (existingScrobble === undefined && this.verboseOptions.match.onNoMatch)) { const closestScrobble = `Closest Scrobble: ${buildTrackString(closestMatch.scrobble, scoreTrackOpts)} => ${closestMatch.confidence}`; - this.logger.debug(`(Existing Check) Source: ${buildTrackString(playObj, scoreTrackOpts)} => ${closestScrobble}`); + this.logger.debug(`${capitalize(playObj.meta.source ?? 'Source')}: ${buildTrackString(playObj, scoreTrackOpts)} => ${closestScrobble}`, {leaf: ['Dupe Check']}); if (this.verboseOptions.match.confidenceBreakdown === true) { this.logger.debug(`Breakdown: -${closestMatch.breakdowns.join('\n')}`); +${closestMatch.breakdowns.join('\n')}`, {leaf: ['Dupe Check']}); } } return existingScrobble; diff --git a/src/backend/tests/plays/mixedDuration.json b/src/backend/tests/plays/mixedDuration.json index 0e03affd..a8ee964e 100644 --- a/src/backend/tests/plays/mixedDuration.json +++ b/src/backend/tests/plays/mixedDuration.json @@ -7,9 +7,6 @@ "track": "Fricassee", "duration": 305, "playDate": "2023-09-20T14:32:39.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -19,9 +16,6 @@ ], "track": "Jimbó", "playDate": "2023-09-20T14:46:00.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -33,9 +27,6 @@ "track": "Aisha", "duration": 559, "playDate": "2023-09-20T15:10:09.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -47,9 +38,6 @@ "track": "Ballade No. 4 in F Minor, Op. 52", "duration": 575, "playDate": "2023-09-20T15:17:12.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -62,9 +50,6 @@ "duration": 327, "listenedFor": 327, "playDate": "2023-09-27T20:02:17.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -74,9 +59,6 @@ ], "track": "Aprieta (Oye Cómo Va)", "playDate": "2023-09-20T15:38:12.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -86,9 +68,6 @@ ], "track": "Another Brick in the Wall, Pt. 1", "playDate": "2023-09-20T15:39:12.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -101,9 +80,6 @@ "duration": 575, "listenedFor": 570, "playDate": "2023-09-20T15:41:12.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -116,9 +92,6 @@ "track": "Aquil", "listenedFor": 300, "playDate": "2023-09-20T17:55:05.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -129,9 +102,6 @@ "track": "Da Art of Storytellin' (Pt. 1)", "duration": 422, "playDate": "2023-09-20T15:39:12.000Z" - }, - "meta": { - "source": "Maloja" } }, { @@ -148,9 +118,6 @@ "track": "Freeze Tag", "album": "Dinner Party: Dessert", "playDate": "2024-01-01T16:29:26.000Z" - }, - "meta": { - "source": "Maloja" } } ] diff --git a/src/backend/tests/scrobbler/scrobblers.test.ts b/src/backend/tests/scrobbler/scrobblers.test.ts index 6d7e2dbc..e70484aa 100644 --- a/src/backend/tests/scrobbler/scrobblers.test.ts +++ b/src/backend/tests/scrobbler/scrobblers.test.ts @@ -339,7 +339,7 @@ describe('Detects duplicate and unique scrobbles from client recent history', fu testScrobbler.recentScrobbles = normalizedWithDur; - const timeEnd = clone(normalizedWithDur[normalizedWithMixedDur.length - 1]); + const timeEnd = clone(normalizedWithDur[normalizedWithMixedDur.length - 2]); timeEnd.data.playDate = timeEnd.data.playDate.add(timeEnd.data.duration, 's'); assert.isTrue(await testScrobbler.alreadyScrobbled(timeEnd)); diff --git a/src/backend/tests/utils/PlayTestUtils.ts b/src/backend/tests/utils/PlayTestUtils.ts index e4bf1cc7..49fd73b4 100644 --- a/src/backend/tests/utils/PlayTestUtils.ts +++ b/src/backend/tests/utils/PlayTestUtils.ts @@ -88,7 +88,7 @@ export const generatePlay = (data: ObjectPlayData = {}, meta: PlayMeta = {}): Pl ...data }, meta: { - source: faker.word.noun(), + source: ['Spotify', 'Listenbrainz', 'Lastfm', 'Jellyfin', 'Plex'][faker.number.int({min: 0, max: 4})], ...meta, } }