feat: keep radio playing when a small library is exhausted
A mood with fewer tracks than a batch used to return an empty queue once the session had heard everything. Allow controlled replay of already-heard tracks once no unheard candidates remain, while still never repeating a track inside one batch and never leaving the owner's music folders.
This commit is contained in:
1 parent
13f36daeab
commit
0df1da7cf7
3 files changed
+10
-4
No files matched your search
@@ -180,7 +180,12 @@ class ApiRoutesTest {
|
||||
assertEquals(HttpStatusCode.OK, second.status)
|
||||
val nextIds = parse(second.bodyAsText())["songs"]!!.jsonArray
|
||||
.map { it.jsonObject.string("id") }
|
||||
assertTrue(nextIds.none { it in queue.map { song -> song.string("id") } })
|
||||
// The test library is smaller than the batch, so the session has
|
||||
// already heard everything. Replay is allowed, duplicates in one
|
||||
// batch are not, and non-music folders still never appear.
|
||||
assertTrue(nextIds.isNotEmpty())
|
||||
assertEquals(nextIds.size, nextIds.distinct().size)
|
||||
assertTrue(nextIds.none { it == seed.longformSong || it == seed.bobSong })
|
||||
|
||||
val completed = client.post("/api/v1/sessions/$sessionId/events") {
|
||||
bearer(token)
|
||||
|
||||
Reference in new issue
Block a user