From aab665356867143cd471855f46e9fed617f4c3b9 Mon Sep 17 00:00:00 2001 From: Simon Garrelou Date: Sat, 10 Dec 2022 17:49:07 +0100 Subject: Play album/song next / end --- music/playqueue.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'music') diff --git a/music/playqueue.go b/music/playqueue.go index 7c21b9b..235007e 100644 --- a/music/playqueue.go +++ b/music/playqueue.go @@ -43,9 +43,17 @@ func (q *Queue) Append(s *subsonic.Child) { q.songs = append(q.songs, s) } +func (q *Queue) Insert(i int, s *subsonic.Child) { + q.songs = append(q.songs[:i], append([]*subsonic.Child{s}, q.songs[i:]...)...) +} + func (q *Queue) Clear() { q.songs = make([]*subsonic.Child, 0) - speaker.Clear() + if q.isPaused { + q.TogglePause() + } + q.Stop() + q.triggerChange() } func (q *Queue) PlaySong(s *subsonic.Child) error { -- cgit v1.2.3