Mix known songs into discover mixes at a fixed ratio
"Play mix" in the discover UI used to spread new songs through the whole library playlist, so the share of new songs depended on how many there were. It now plays the new songs with songs the user has played mixed in evenly at the rule's familiar_ratio (30% by default), the same ratio that sets how much of the Subsonic playlist is familiar. Which songs in each mix playlist were played recently is now recorded when the mix is built (cluster_mix_playlist.known_song_ids) and returned with the mix; the UI marks them as "Played". Mixes built before this fall back to using the library songs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
This commit is contained in:
11 files changed
+92
-22
No files matched your search
+11
@@ -82,6 +82,8 @@ struct MixDetail {
|
||||
#[serde(flatten)]
|
||||
summary: MixSummary,
|
||||
songs: Vec<Track>,
|
||||
/// Songs in `songs` the user played recently
|
||||
known_song_ids: Vec<String>,
|
||||
suggestions: Vec<MixSuggestion>,
|
||||
}
|
||||
|
||||
@@ -117,6 +119,14 @@ async fn mix(
|
||||
})?
|
||||
.entry;
|
||||
|
||||
let known_song_ids = sqlx::query_scalar!(
|
||||
r#"SELECT known_song_ids FROM "cluster_mix_playlist" WHERE id = $1"#,
|
||||
id
|
||||
)
|
||||
.fetch_one(pool.inner())
|
||||
.await
|
||||
.map_err(db_error)?;
|
||||
|
||||
let suggestions = sqlx::query_as!(
|
||||
MixSuggestion,
|
||||
r#"
|
||||
@@ -133,6 +143,7 @@ async fn mix(
|
||||
Ok(Json(MixDetail {
|
||||
summary,
|
||||
songs,
|
||||
known_song_ids,
|
||||
suggestions,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user