From c13e7ebeecaab6ff9f5d8ad204d9245f14127db1 Mon Sep 17 00:00:00 2001 From: Exerra Date: Wed, 15 Jul 2026 15:38:14 +0300 Subject: [PATCH] feat(applemusic): strip ' - EP' and ' - Single' from album names Implemented album name normalization in AppleMusicSource to ensure consistency with other sources by removing standard suffixes from EPs and singles. Updated documentation to reflect this behavior. --- docsite/docs/configuration/sources/applemusic.mdx | 4 ++++ src/backend/sources/AppleMusicSource.ts | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docsite/docs/configuration/sources/applemusic.mdx b/docsite/docs/configuration/sources/applemusic.mdx index 560463ac..d19fd649 100644 --- a/docsite/docs/configuration/sources/applemusic.mdx +++ b/docsite/docs/configuration/sources/applemusic.mdx @@ -120,6 +120,10 @@ If Multi-Scrobbler polled when the top track was Song A, and polls again after i If you ever experience false positives (tracks being scrobbled that you didn't actually re-listen to), you can disable this recovery behavior with `"recoverUnchangedTopHistory": false` in your config options or by setting the `APPLEMUSIC_RECOVER_UNCHANGED_TOP_HISTORY=false` env var. +#### Album name normalization + +The Apple Music API appends ` - EP` or ` - Single` to the album name for EPs and singles. Multi-Scrobbler strips this out so that the album name matches other sources. + ## Configuration Reference diff --git a/src/backend/sources/AppleMusicSource.ts b/src/backend/sources/AppleMusicSource.ts index 6e298333..ef7f443f 100644 --- a/src/backend/sources/AppleMusicSource.ts +++ b/src/backend/sources/AppleMusicSource.ts @@ -117,10 +117,16 @@ export default class AppleMusicSource extends AbstractSource { static formatPlayObj(track: Song, options: {newFromSource?: boolean} = {}): PlayObject { const {newFromSource = false} = options; + + // Apple Music appends " - EP" or " - Single" to the album name for EPs and singles + // We strip this out so it matches other sources + let albumName = track.albumName + albumName = albumName.replace(/ - (EP|Single)$/i, ''); + const play: PlayObjectMinimal = { data: { artists: artistNamesToCredits([track.artistName]), - album: track.albumName, + album: albumName, track: track.name, duration: track.durationInMillis ? Math.round(track.durationInMillis / 1000) : undefined, }, -- 2.51.2