cycle album when loopAll is checked

This commit is contained in:
Siiiiinth
2026-01-08 23:02:06 +01:00
parent 8d8a67f35c
commit 2c19f9f926
+9 -3
View File
@@ -313,11 +313,17 @@ func (p *playbackEngine) SeekFwdBackN(n int) error {
if n == 0 || (idx == 0 && n < 0) { if n == 0 || (idx == 0 && n < 0) {
return p.player.SeekSeconds(0) // seek back in current song return p.player.SeekSeconds(0) // seek back in current song
} }
lastIdx := len(p.playQueue) - 1 lastIdx := len(p.playQueue) - 1
if idx == lastIdx && n > 0 {
return nil // already on last track, nothing to seek next to
}
newIdx := min(lastIdx, max(0, idx+n)) newIdx := min(lastIdx, max(0, idx+n))
if idx == lastIdx && n > 0 {
if p.loopMode == LoopAll {
newIdx = 0
} else {
return nil // already on last track, nothing to seek next to
}
}
return p.PlayTrackAt(newIdx) return p.PlayTrackAt(newIdx)
} }