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
@@ -123,8 +123,8 @@ class RadioService {
|
||||
|
||||
candidates.keys.removeAll(skip)
|
||||
|
||||
// When a session has already heard the whole mood, allow controlled replay
|
||||
// instead of ending with silence.
|
||||
// Small libraries can exhaust the mood. Replay tracks the session already
|
||||
// heard instead of returning silence, but never repeat the current batch.
|
||||
if (candidates.size < limit) {
|
||||
LibraryRepository.randomSongs(
|
||||
size = max(limit * 10, 200),
|
||||
@@ -134,7 +134,7 @@ class RadioService {
|
||||
folderIds = folders,
|
||||
userName = user.name,
|
||||
).forEach { song ->
|
||||
if (song.id !in skip || sessionSongs.size > 200) {
|
||||
if (song.id !in excluded) {
|
||||
candidates.putIfAbsent(song.id, song)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user