Upgraded Go version and the version of all dependencies. Fixed som more bugs.
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"io/fs"
|
||||
"music-server/pkg/db"
|
||||
"music-server/pkg/models"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
@@ -36,7 +34,7 @@ type embedFileSystem struct {
|
||||
indexes bool
|
||||
}
|
||||
|
||||
func (e embedFileSystem) Exists(prefix string, path string) bool {
|
||||
func (e embedFileSystem) Exists(_ string, path string) bool {
|
||||
f, err := e.Open(path)
|
||||
if err != nil {
|
||||
return false
|
||||
@@ -62,20 +60,6 @@ func EmbedFolder(fsEmbed embed.FS, targetPath string, index bool) static.ServeFi
|
||||
}
|
||||
}
|
||||
|
||||
func CheckIfSongExists(song models.SongData) bool {
|
||||
//Check if file exists and open
|
||||
openFile, err := os.Open(song.Path)
|
||||
if err != nil {
|
||||
//File not found
|
||||
db.RemoveBrokenSong(song)
|
||||
return false
|
||||
}
|
||||
defer func(openFile *os.File) {
|
||||
_ = openFile.Close()
|
||||
}(openFile) //Close after function return
|
||||
return true
|
||||
}
|
||||
|
||||
func SendSong(ctx *gin.Context, Filename string) {
|
||||
fmt.Println("Client requests: " + Filename)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user