This commit is contained in:
@@ -140,7 +140,7 @@ func GetRandomSongClassic() string {
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
repo.RemoveBrokenSong(db.Ctx, song.Path)
|
repo.RemoveBrokenSong(db.Ctx, song.Path)
|
||||||
log.Printf("Song not found, song '%s' deleted from game '%s' FileName: %v\n", song.SongName, gameData.GameName, song.FileName)
|
log.Printf("Song not found, song '%s' deleted from game '%s' FileName: %s\n", song.SongName, gameData.GameName, *song.FileName)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ func GetRandomSongClassic() string {
|
|||||||
if err != nil || (song.FileName != nil && gameData.Path+*song.FileName != song.Path) {
|
if err != nil || (song.FileName != nil && gameData.Path+*song.FileName != song.Path) {
|
||||||
//File not found
|
//File not found
|
||||||
repo.RemoveBrokenSong(db.Ctx, song.Path)
|
repo.RemoveBrokenSong(db.Ctx, song.Path)
|
||||||
log.Printf("Song not found, song '%s' deleted from game '%s' FileName: %v\n", song.SongName, gameData.GameName, song.FileName)
|
log.Printf("Song not found, song '%s' deleted from game '%s' FileName: %s\n", song.SongName, gameData.GameName, *song.FileName)
|
||||||
} else {
|
} else {
|
||||||
songFound = true
|
songFound = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"music-server/internal/backend"
|
"music-server/internal/backend"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
@@ -155,21 +156,17 @@ func (m *MusicHandler) GetAllGamesRandom(ctx echo.Context) error {
|
|||||||
return ctx.JSON(http.StatusOK, gameList)
|
return ctx.JSON(http.StatusOK, gameList)
|
||||||
}
|
}
|
||||||
|
|
||||||
type played struct {
|
|
||||||
Song int
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MusicHandler) PutPlayed(ctx echo.Context) error {
|
func (m *MusicHandler) PutPlayed(ctx echo.Context) error {
|
||||||
if backend.Syncing {
|
if backend.Syncing {
|
||||||
log.Println("Syncing is in progress")
|
log.Println("Syncing is in progress")
|
||||||
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
|
return ctx.JSON(http.StatusLocked, "Syncing is in progress")
|
||||||
}
|
}
|
||||||
var played played
|
song, err := strconv.Atoi(ctx.QueryParam("song"))
|
||||||
err := ctx.Bind(&played)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.JSON(http.StatusBadRequest, err)
|
return ctx.JSON(http.StatusBadRequest, err)
|
||||||
}
|
}
|
||||||
backend.SetPlayed(played.Song)
|
log.Println("song", song)
|
||||||
|
backend.SetPlayed(song)
|
||||||
return ctx.NoContent(http.StatusOK)
|
return ctx.NoContent(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ func (s *Server) RegisterRoutes() http.Handler {
|
|||||||
syncGroup.GET("", sync.SyncGamesNewOnlyChanges)
|
syncGroup.GET("", sync.SyncGamesNewOnlyChanges)
|
||||||
syncGroup.GET("/progress", sync.SyncProgress)
|
syncGroup.GET("/progress", sync.SyncProgress)
|
||||||
syncGroup.GET("/new", sync.SyncGamesNewOnlyChanges)
|
syncGroup.GET("/new", sync.SyncGamesNewOnlyChanges)
|
||||||
|
syncGroup.GET("/full", sync.SyncGamesNewFull)
|
||||||
syncGroup.GET("/new/full", sync.SyncGamesNewFull)
|
syncGroup.GET("/new/full", sync.SyncGamesNewFull)
|
||||||
syncGroup.GET("/quick", sync.SyncGamesNewOnlyChanges)
|
syncGroup.GET("/quick", sync.SyncGamesNewOnlyChanges)
|
||||||
syncGroup.GET("/reset", sync.ResetGames)
|
syncGroup.GET("/reset", sync.ResetGames)
|
||||||
|
|||||||
Reference in New Issue
Block a user