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

@@ -16,11 +16,15 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
testf()
data := VersionData{Version: "2.1.0",
data := VersionData{Version: "2.1.1",
Changelog: "Fixed bug where wrong song was showed as currently played.",
History: []VersionData{
{
Version: "2.1.0",
Changelog: "Added /addQue to add the last received song to the songQue. " +
"Changed /rand and /rand/low to not add song to the que. " +
"Changed /next to not call /rand when the end of the que is reached, instead the last song in the que will be resent.",
History: []VersionData{
},
{
Version: "2.0.3",
Changelog: "Another small change that should fix the caching problem.",

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