Skip to content

fix: load lyrics for multi-artist tracks (#410) - #422

Merged
LargeModGames merged 1 commit into
mainfrom
fix/lyrics-multi-artist-410
Aug 5, 2026
Merged

fix: load lyrics for multi-artist tracks (#410)#422
LargeModGames merged 1 commit into
mainfrom
fix/lyrics-multi-artist-410

Conversation

@LargeModGames

@LargeModGames LargeModGames commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #410. Lyrics never appeared for tracks credited to more than one artist (e.g. "Take Me Back" by Kygo and Max McNown), even when LRCLIB clearly had the track.

Root cause: LRCLIB indexes each track under a single artist string (almost always the primary credit), but spotatui sent the full joined credit ("Kygo, Max McNown") to both the exact /api/get and the fuzzy /api/search endpoints, so every collaboration missed. The PlaybackMetadata.artists field was typed Vec<String> but in practice always held one pre-joined display string, so there was no way to recover the individual artists downstream.

The fix threads the real per-artist list through instead of a display string:

  • The playback snapshot now carries individual artist names as a structured list (both the native-streaming and Spotify-context paths). NativeTrackInfo.artists_display: String became artists: Vec<String>, populated from the structured list already present at the player-event boundary.
  • The LRCLIB lookup (network/utils.rs) now tries a candidate ladder: all /api/get candidates first, then all /api/search, where candidates are [full joined credit, primary artist alone]. The primary artist comes from the structured list (never a ", " split), so an act whose own name contains a comma (e.g. "Earth, Wind & Fire") plus a guest is not corrupted.

Side effect: MPRIS xesam:artist is now a genuine array instead of a single joined element. Display is unchanged (primary_artist() still joins the list), and the friends-widget backend already joins the artists array with ", ", so there is no wire-format change.

Testing

  • cargo fmt --all
  • cargo clippy --no-default-features --features telemetry -- -D warnings (clean)
  • cargo clippy -- -D warnings (default, clean)
  • cargo clippy --features all-sources -- -D warnings (clean)
  • cargo test --no-default-features --features telemetry (510 passed)
  • cargo test (default, 771 passed)
  • cargo test --features all-sources (843 passed)
  • Added unit tests for the artist candidate ladder and a snapshot regression test for a multi-artist native track.
  • Live: played "Take Me Back" (Kygo, Max McNown) on the native device and the synced lyrics now render.

Additional notes

The earlier fix for this issue (#411) added the /api/get -> /api/search fallback but still passed the joined multi-artist string to both endpoints, so collaborations stayed broken; this addresses the underlying data shape. Local-files (single lofty artist string) and internet radio (no track duration, so no lyrics) are intentionally left as-is.

Summary by CodeRabbit

  • Bug Fixes

    • Lyrics now load correctly for collaboration tracks.
    • Lookup tries the complete artist credits first, then falls back to the primary artist.
    • Artist names containing commas are handled correctly.
    • Artist display formatting remains unchanged in the player interface.
  • Tests

    • Added coverage for solo artists, collaborations, fallback lookups, and empty artist lists.

The lyrics lookup received the full joined artist credit, but LRCLIB
indexes each track under a single (usually primary) artist. So a
collaboration like "Take Me Back" by Kygo and Max McNown 404'd on
/api/get and returned nothing from /api/search, showing "No lyrics"
even though LRCLIB had the song.

The playback snapshot now carries the individual artist names as a
structured list instead of one pre-joined string, and the LRCLIB
lookup falls back to the primary artist alone when the full credit
finds nothing. Keeping the list structured also makes MPRIS
xesam:artist a real array. Display is unchanged: primary_artist()
still joins the list, and the friends widget backend already joins
the array with ", ".
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a77d0df9-3783-4b5a-b1e8-b07292c4a923

📥 Commits

Reviewing files that changed from the base of the PR and between ed3a9a5 and aec2dbf.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • src/core/app.rs
  • src/infra/media_metadata.rs
  • src/infra/network/mod.rs
  • src/infra/network/utils.rs
  • src/infra/player/events.rs
  • src/infra/scripting/tests.rs
  • src/tui/runner.rs
  • src/tui/ui/player.rs

📝 Walkthrough

Walkthrough

NativeTrackInfo now preserves ordered artist names. Lyrics requests pass the full artist list to LRCLIB, then fall back to the primary artist. Metadata, playback, scripting, and lookup tests were updated for collaboration tracks.

Changes

Collaboration Lyrics Lookup

Layer / File(s) Summary
Structured artist metadata
src/core/app.rs, src/infra/media_metadata.rs, src/infra/player/events.rs, src/tui/ui/player.rs
Track metadata stores ordered artist names. Display paths join the names when required.
LRCLIB candidate lookup
src/infra/network/utils.rs
Lyrics lookup tries exact and fuzzy requests for the full artist credit and the primary artist. Tests cover collaborations, comma-containing names, solo artists, and empty lists.
Lyrics event wiring and validation
src/infra/network/mod.rs, src/tui/runner.rs, src/infra/scripting/tests.rs, CHANGELOG.md
Playback requests forward structured artist lists. Fixtures and changelog entries reflect the collaboration lookup behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TuiRunner
  participant NetworkEvent
  participant UtilsNetwork
  participant LRCLIB
  TuiRunner->>NetworkEvent: Dispatch GetLyrics with artist list
  NetworkEvent->>UtilsNetwork: Call get_lyrics
  UtilsNetwork->>LRCLIB: Try full-credit and primary-artist candidates
  LRCLIB-->>UtilsNetwork: Return lyrics response
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the accepted fix: prefix, clearly describes the lyric-loading fix, and uses a concise imperative subject.
Linked Issues check ✅ Passed The changes address issue #410 by preserving artist lists and adding LRCLIB fallback lookup for multi-artist tracks.
Out of Scope Changes check ✅ Passed The changes remain focused on lyric lookup, artist metadata handling, display behavior, documentation, and related tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lyrics-multi-artist-410
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/lyrics-multi-artist-410

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LargeModGames
LargeModGames merged commit 35e8a80 into main Aug 5, 2026
16 checks passed
@LargeModGames
LargeModGames deleted the fix/lyrics-multi-artist-410 branch August 5, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No lyrics for this track appear even when LRCLIB has the specific song

1 participant