fix: load lyrics for multi-artist tracks (#410) - #422
Merged
Conversation
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 ", ".
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthrough
ChangesCollaboration Lyrics Lookup
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/getand the fuzzy/api/searchendpoints, so every collaboration missed. ThePlaybackMetadata.artistsfield was typedVec<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:
NativeTrackInfo.artists_display: Stringbecameartists: Vec<String>, populated from the structured list already present at the player-event boundary.network/utils.rs) now tries a candidate ladder: all/api/getcandidates 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:artistis 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 --allcargo 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)Additional notes
The earlier fix for this issue (#411) added the
/api/get->/api/searchfallback 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
Tests