Repository navigation
feat(subsonic): balance the similar-songs draw across artists - #274
Conversation
One pool of tracks let an artist with many tracks fill most of the answer with their own songs. Artists now take turns, one track each at random, and one that runs out leaves its turns to the others; the result is shuffled. Signed-off-by: InstaZDLL <github.105mh@8shield.net>
Signed-off-by: InstaZDLL <github.105mh@8shield.net>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Summary
A follow-up to #273 (step E, #267). The similar-songs draw took tracks at random from one pool, so an artist with two hundred tracks beside three neighbours with ten each filled about 43 of the 50 places with their own songs. That conforms to the specification ("a random collection"), but it is not what a client asking for similar songs means.
DomainServices::similar_songs,src/services/artist_enrichment.rs). Inside each artist, tracks are ranked at random. The draw then takes rank 1 of every artist, then rank 2, and so on. An artist that runs out leaves its turns to the others, socountis still reached while tracks remain. The result is shuffled, so it does not play artist by artist.MIN, which returns the row holding the minimum.subsonic-api-guide.md(which now also says thatgetSimilarSongs2documents only an artist id and accepts all three), the handler's doc comment, and a revision note on RFC-011 decision 7.How I tested
cargo test --all-features: every target passes.enrichmentgrows from 18 to 20 tests. Its fixture gainslibrary_with, which gives a track an artist different from its album's.cargo clippy --all-targets --all-features -- -D warnings,cargo fmt --all --check.a_prolific_artist_does_not_crowd_out_the_neighbours(60 tracks beside 5, 20 drawn: all 5 are in)ORDER BY RANDOM()without the rank)a_neighbour_s_album_of_guests_takes_one_share(60 beside a 10-guest album, 4 drawn: exactly 2 are Björk's)PARTITION BY s.artist_id)Summary by CodeRabbit
count(50 par défaut) et que la recherche accepte aussi des identifiants d’album ou de morceau.