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

Closed
SuchBlue wants to merge 1 commit from master into master
SuchBlue commented 2025-05-11 11:07:08 +00:00 (Migrated from github.com)

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 ![image](https://github.com/user-attachments/assets/04d3bf2f-d87a-481e-a9cc-64d31fb7c18a) ![image](https://github.com/user-attachments/assets/78fdd071-20cc-4b68-b6e4-0a40c225ee8d) Despite a song having multiple artists, Last.fm only considers the main artist as the "Artist" of the song.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-05-27 06:01:07 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

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"),
## 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. <details> <summary>Comments suppressed due to low confidence (1)</summary> **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"), ``` </details>
@ -142,3 +137,3 @@
duration: songInfo.songDuration,
artist: artist,
artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring).*$/, "$1"),
...(songInfo.album ? { album: songInfo.album } : undefined), // Will be undefined if current song is a video
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-05-27 06:01:07 +00:00

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.

      artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring|feat\.|ft\.).*$/i, "$1").trim(),
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. ```suggestion artist: songInfo.artist.replace(/(.*?)(?:&|,|featuring|feat\.|ft\.).*$/i, "$1").trim(), ```
angelajfisher commented 2025-08-01 01:52:23 +00:00 (Migrated from github.com)

It looks like this would fix #3641. What still needs to be done to get it over the finish line? Happy to lend a hand if needed ☺️

It looks like this would fix #3641. What still needs to be done to get it over the finish line? Happy to lend a hand if needed ☺️

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: YTMD/youtube-music#3358
No description provided.