diff --git a/indexFacade.go b/indexFacade.go index 303f095..8e76ddd 100644 --- a/indexFacade.go +++ b/indexFacade.go @@ -16,11 +16,15 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { testf() - data := 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.", + 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.", + }, { Version: "2.0.3", Changelog: "Another small change that should fix the caching problem.", diff --git a/musicFacade.go b/musicFacade.go index 8665602..80c662d 100644 --- a/musicFacade.go +++ b/musicFacade.go @@ -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