finish config_basic.go

This commit is contained in:
Aynakeya
2022-06-29 00:42:59 -07:00
parent dd46c167ff
commit c78922cf09
13 changed files with 240 additions and 107 deletions

View File

@@ -58,7 +58,14 @@ func (p *Playlist) Pop() *Media {
return nil
}
p.Lock.Lock()
media := p.Playlist[0]
index := 0
if p.Config.RandomNext {
index = rand.Intn(p.Size())
}
media := p.Playlist[index]
for i := index; i > 0; i-- {
p.Playlist[i] = p.Playlist[i-1]
}
p.Playlist = p.Playlist[1:]
p.Lock.Unlock()
defer p.Handler.CallA(EventPlaylistUpdate, PlaylistUpdateEvent{Playlist: p})