Changed addPlayed
This commit is contained in:
@@ -39,16 +39,29 @@ func AddLatestToQue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddLatestPlayed() {
|
func AddLatestPlayed() {
|
||||||
if lastFetched.Path != "" {
|
if len(songQue) == 0 {
|
||||||
db.AddGamePlayed(lastFetched.GameId)
|
return
|
||||||
}
|
}
|
||||||
|
var currentSongData = songQue[currentSong]
|
||||||
|
|
||||||
|
db.AddGamePlayed(currentSongData.GameId)
|
||||||
|
db.AddSongPlayed(currentSongData.GameId, currentSongData.SongName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetPlayed(songNumber int) {
|
||||||
|
if len(songQue) == 0 || songNumber >= len(songQue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var songData = songQue[songNumber]
|
||||||
|
db.AddGamePlayed(songData.GameId)
|
||||||
|
db.AddSongPlayed(songData.GameId, songData.SongName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRandomSong() string {
|
func GetRandomSong() string {
|
||||||
if games == nil || len(games) == 0 {
|
if len(games) == 0 {
|
||||||
games = db.FindAllGames()
|
games = db.FindAllGames()
|
||||||
}
|
}
|
||||||
if games == nil || len(games) == 0 {
|
if len(games) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +71,7 @@ func GetRandomSong() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetRandomSongLowChance() string {
|
func GetRandomSongLowChance() string {
|
||||||
if games == nil || len(games) == 0 {
|
if len(games) == 0 {
|
||||||
games = db.FindAllGames()
|
games = db.FindAllGames()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,15 +207,6 @@ func GetAllGamesRandom() []string {
|
|||||||
return jsonArray
|
return jsonArray
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetPlayed(songNumber int) {
|
|
||||||
if songQue == nil || len(songQue) == 0 || songNumber >= len(songQue) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var songData = songQue[songNumber]
|
|
||||||
db.AddGamePlayed(songData.GameId)
|
|
||||||
db.AddSongPlayed(songData.GameId, songData.SongName)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetNextSong() string {
|
func GetNextSong() string {
|
||||||
if songQue == nil {
|
if songQue == nil {
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Reference in New Issue
Block a user