feat: mix mood radio by seed percentage and embed download artwork
Moods now store a seedPercent (0-100, default 50). RadioService rolls that share independently for every queued slot: heads picks from the seed songs, tails from the generated recommendation pool. When one pool is empty the other fills the batch, so a mood never stalls. The DTO exposes both seedPercent and the derived recommendationPercent, and create/patch accept seedPercent. Automatic YT downloads now embed the video thumbnail as MP3 cover art so the scanner publishes a cover for newly imported tracks. V7 adds moods.seed_percent.
This commit is contained in:
1 parent
dd7bbde84d
commit
c75f2971b4
11 files changed
+146
-6
No files matched your search
@@ -4,6 +4,7 @@ import io.ktor.client.HttpClient
|
||||
import io.ktor.client.request.delete
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.header
|
||||
import io.ktor.client.request.patch
|
||||
import io.ktor.client.request.post
|
||||
import io.ktor.client.request.put
|
||||
import io.ktor.client.request.setBody
|
||||
@@ -153,6 +154,17 @@ class ApiRoutesTest {
|
||||
val moodId = mood["mood"]!!.jsonObject.string("id")
|
||||
assertEquals(1, mood["mood"]!!.jsonObject.int("seedCount"))
|
||||
assertTrue(mood["seeds"]!!.jsonArray.isNotEmpty())
|
||||
assertEquals(50, mood["mood"]!!.jsonObject.int("seedPercent"))
|
||||
assertEquals(50, mood["mood"]!!.jsonObject.int("recommendationPercent"))
|
||||
|
||||
val mixed = client.patch("/api/v1/moods/$moodId") {
|
||||
bearer(token)
|
||||
contentType(ContentType.Application.Json)
|
||||
setBody("""{"seedPercent":70}""")
|
||||
}
|
||||
val mixedMood = parse(mixed.bodyAsText())["mood"]!!.jsonObject
|
||||
assertEquals(70, mixedMood.int("seedPercent"))
|
||||
assertEquals(30, mixedMood.int("recommendationPercent"))
|
||||
|
||||
// Long-form can never be a mood seed.
|
||||
val withLongform = client.post("/api/v1/moods") {
|
||||
|
||||
Reference in new issue
Block a user