Re-add ShufflePlaylist
parent
891fa050e1
commit
605bd7f29e
|
@ -6,6 +6,7 @@ import (
|
|||
discordspeaker "dndmusicbot/speaker"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
|
@ -528,16 +529,18 @@ func (app *App) loadPlaylist(payload ...interface{}) {
|
|||
}
|
||||
|
||||
list, err := ytdl_client.GetPlaylist(pl.Url)
|
||||
|
||||
if err != nil {
|
||||
log.Println("Error getting playlist info,", id)
|
||||
return
|
||||
}
|
||||
|
||||
rand.Shuffle(len(list.Videos), func(i, j int) { list.Videos[i], list.Videos[j] = list.Videos[j], list.Videos[i] })
|
||||
|
||||
app.plmutex.Lock()
|
||||
if app.plcancel != nil {
|
||||
app.plcancel()
|
||||
}
|
||||
|
||||
app.mpd.Stop()
|
||||
app.mpd.Clear()
|
||||
app.plmutex.Unlock()
|
||||
|
|
Loading…
Reference in New Issue