Repository navigation
feat(subsonic): getSimilarSongs and getSimilarSongs2 draw from the artist and their neighbours - #273
Conversation
…tist and their neighbours Both methods resolve an artist, album or song id first and for its refusal, then answer a random draw of at most count (default 50) from the artist's own tracks and their visible neighbours', read from the enrichment cache. With no provider configured they stay the empty container they always were. The credit rule that decides which tracks are an artist's is now one macro, shared with getTopSongs. Closes #267. 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
|
Signed-off-by: InstaZDLL <github.105mh@8shield.net>
Summary
Step E of the enrichment plan, which implements RFC-011. With no provider configured, which is the default, both methods still answer the empty container they always did, for any id the caller can reach.
DomainServices::similar_songs(src/services/artist_enrichment.rs), called bygetSimilarSongsandgetSimilarSongs2(src/subsonic/browse.rs).artist_behind): an artist id, an album id (standing for its album artist) or a song id (standing for its track artist). An id the caller cannot reach is error 70, exactly like one naming nothing, and no provider is asked about it. An album or a song credited to no artist draws nothing.getSimilarSongs2documents only artist ids but accepts all three: refusing an id the service can resolve would only make it worse.countdefaults to 50, is capped at 500, andcount=0is an empty container (after the id is resolved).getArtistInfoshows: the first provider, in the operator's order, whose cached list names an artist the caller can see (the loop is factored intoneighbours, shared with feat(enrichment): getArtistInfo and the native artist page read the cache #272'senrichment_of). Every name then draws by canonical name, so an artist the caller sees in two libraries contributes both. Tenancy is the membership bind ofsong_select!, which keeps a track in a library the caller is not in out of the draw even when its artist shares a name with a visible one.artist_credit_clause!insrc/services/mod.rs: a track names the artist in itsartistrole, or its album credits them as album artist.getTopSongsuses the same macro, unchanged in behaviour.similarSongs.songandsimilarSongs2.songjoin the array allowlist. They held nothing until now, so nothing had told them apart from an object.tests/subsonic_methods.rsasserted the old answer forid=whatever, and now asserts error 70 for an unknown UUID.subsonic-api-guide.md, the dated note insubsonic-compatibility.md(which still saidgetArtistInfowas empty, so feat(enrichment): getArtistInfo and the native artist page read the cache #272 is corrected there too), and RFC-011's Implemented by line.Closes #267.
How I tested
cargo test --all-features: every target passes.enrichmentgrows from 14 to 18 tests.cargo clippy --all-targets --all-features -- -D warnings,cargo fmt --all --check.subsonic_key, now shared with feat(enrichment): getArtistInfo and the native artist page read the cache #272's façade test). No literal goes into a cryptographic call.an_album_id_and_a_song_id_reach_the_same_artist_as_the_artist_idthe_artist_s_own_tracks_are_in_the_drawno_track_from_a_library_the_caller_is_not_insong_select!((m.user_id=? OR 1))count_absent_yields_at_most_fiftycountis 500 instead of 50library_member(feat(enrichment): getArtistInfo and the native artist page read the cache #272's test covers that layer).Summary by CodeRabbit
getSimilarSongsetgetSimilarSongs2peuvent renvoyer jusqu’à 500 morceaux de l’artiste associé à un artiste, un album ou un morceau, ainsi que de ses voisins accessibles. Par défaut, 50 morceaux sont demandés.