mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
fix: use Random mode for FM instead of RandomLoop to prevent song repeats
RandomLoop randomly selects from queue, causing the same song to play multiple times when the queue is small (~3 songs from personal_fm API). Random mode ensures each song plays once before repeating, relying on refillFm() to fetch fresh songs before exhaustion. Also fix the proactive refill condition to use unplayedCount() instead of size() - getCurrentIndex(), which was meaningless for non-sequential play modes.
This commit is contained in:
1 parent
4de8ac1810
commit
fe78bf812c
2 files changed
+8
-3
No files matched your search
@@ -161,4 +161,9 @@ export class PlayQueue {
|
||||
getCurrentIndex(): number {
|
||||
return this.currentIndex;
|
||||
}
|
||||
|
||||
/** Number of songs not yet played in Random mode. */
|
||||
unplayedCount(): number {
|
||||
return this.songs.length - this.playedIndices.size;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user