Skip to content

feat(scrobblers): Only broadcast the main artist to Last.fm #3358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuchBlue
Copy link

Songs on Last.fm only have the main artist set, and including any featured artists hinders Last.fm's song detection

image
image

Despite a song having multiple artists, Last.fm only considers the main artist as the "Artist" of the song.

Songs on Last.fm only have the main artist set, and including any featured artists hinders Last.fm's song detection
@JellyBrick JellyBrick requested a review from Copilot May 27, 2025 06:00
@JellyBrick JellyBrick added enhancement New feature or request wontfix This will not be worked on labels May 27, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Last.fm scrobbler to send only the main artist name by stripping out featured or additional artists.

  • Use a regex to extract the primary artist before any &, ,, or featuring segment.
  • No other functional changes.
Comments suppressed due to low confidence (1)

src/plugins/scrobbler/services/lastfm.ts:138

  • Add unit tests for various artist strings (e.g., multiple separators, different casing, parentheses) to verify that the regex correctly extracts the main artist in all cases.
artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring).*$/, "$1"),

@@ -135,7 +135,7 @@ export class LastFmScrobbler extends ScrobblerBase {
const postData: LastFmSongData = {
track: title,
duration: songInfo.songDuration,
artist: songInfo.artist,
artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring).*$/, "$1"),
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making the regex case-insensitive (add the i flag) and including common shorthand patterns like feat\. or ft\. to cover more variations. Also trim the result to remove trailing whitespace.

Suggested change
artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring).*$/, "$1"),
artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring|feat\.|ft\.).*$/i, "$1").trim(),

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants