Fixed bug where wrong song was showed as currently played.

This commit is contained in:
2020-12-28 13:01:58 +01:00
parent 601e5cd14d
commit 6cd1abcf8e
2 changed files with 10 additions and 10 deletions

View File

@@ -36,7 +36,9 @@ func reset() {
func addLatestToQue() {
if lastFetched.path != "" {
currentSong = len(songQue)
songQue = append(songQue, lastFetched)
lastFetched = SongData{}
}
}
@@ -46,12 +48,9 @@ func getRandomSong() string {
}
game := getRandomGame(games)
songs := findSongsFromGame(game.id)
song := songs[rand.Intn(len(songs))]
currentSong = len(songQue)
lastFetched = song
return song.path
}
@@ -75,12 +74,9 @@ func getRandomSongLowChance() string {
}
game := getRandomGame(listOfGames)
songs := findSongsFromGame(game.id)
song := songs[rand.Intn(len(songs))]
currentSong = len(songQue)
lastFetched = song
return song.path