Fixed some bugs
* Fixed bug with sync * Made default list of game randomized * Added get all games ordered * Added air for live reload
This commit is contained in:
36
.air.toml
Normal file
36
.air.toml
Normal file
@@ -0,0 +1,36 @@
|
||||
root = "."
|
||||
testdata_dir = "testdata"
|
||||
tmp_dir = "tmp"
|
||||
|
||||
[build]
|
||||
bin = "./tmp/main"
|
||||
cmd = "go build -o ./tmp/main ./cmd"
|
||||
delay = 1000
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata", "frontend", "swagger", "cmd/frontend", "cmd/swagger"]
|
||||
exclude_file = []
|
||||
exclude_regex = ["_test.go"]
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
include_dir = []
|
||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||
kill_delay = "0s"
|
||||
log = "build-errors.log"
|
||||
send_interrupt = false
|
||||
stop_on_error = true
|
||||
|
||||
[color]
|
||||
app = ""
|
||||
build = "yellow"
|
||||
main = "magenta"
|
||||
runner = "green"
|
||||
watcher = "cyan"
|
||||
|
||||
[log]
|
||||
time = false
|
||||
|
||||
[misc]
|
||||
clean_on_exit = false
|
||||
|
||||
[screen]
|
||||
clear_on_rebuild = false
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
||||
|
||||
tmp
|
||||
6
.idea/dataSources.xml
generated
6
.idea/dataSources.xml
generated
@@ -19,5 +19,11 @@
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://ssh.sanplex.xyz:9432/music_test</jdbc-url>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="music_prod@ssh.sanplex.xyz" uuid="20917ace-4e9a-4273-bdb7-13ebc774cbba">
|
||||
<driver-ref>postgresql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:postgresql://ssh.sanplex.xyz:9432/music_prod</jdbc-url>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
@@ -182,6 +182,25 @@ paths:
|
||||
example: ["God of War", "Final Fantasy VII"]
|
||||
"500":
|
||||
description: "Something went wrong on the server"
|
||||
/music/all/order:
|
||||
get:
|
||||
tags:
|
||||
- "Music"
|
||||
summary: "Gets all games in order"
|
||||
description: "Gets a ordered list of all games that is in the database"
|
||||
operationId: "getAll"
|
||||
responses:
|
||||
"200":
|
||||
description: "A list"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example: [ "God of War", "Final Fantasy VII" ]
|
||||
"500":
|
||||
description: "Something went wrong on the server"
|
||||
/music/all/random:
|
||||
get:
|
||||
tags:
|
||||
|
||||
4
go.sum
4
go.sum
@@ -145,6 +145,8 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@@ -710,6 +712,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
|
||||
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
|
||||
|
||||
@@ -74,7 +74,8 @@ func SetupRestServer(frontend embed.FS, swagger embed.FS) {
|
||||
musicGroup.GET("list", music.GetPlayedSongs)
|
||||
musicGroup.GET("next", music.GetNextSong)
|
||||
musicGroup.GET("previous", music.GetPreviousSong)
|
||||
musicGroup.GET("all", music.GetAllGames)
|
||||
musicGroup.GET("all", music.GetAllGamesRandom)
|
||||
musicGroup.GET("all/order", music.GetAllGames)
|
||||
musicGroup.GET("all/random", music.GetAllGamesRandom)
|
||||
musicGroup.PUT("played", music.PutPlayed)
|
||||
musicGroup.GET("addQue", music.AddLatestToQue)
|
||||
|
||||
@@ -40,7 +40,7 @@ func SyncGames() {
|
||||
|
||||
innerFiles, err := ioutil.ReadDir(path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Println(err)
|
||||
}
|
||||
id := -1
|
||||
for _, song := range innerFiles {
|
||||
@@ -114,7 +114,7 @@ func checkSongs(gameDir string, gameId int) {
|
||||
|
||||
files, err := ioutil.ReadDir(gameDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Println(err)
|
||||
}
|
||||
for _, entry := range files {
|
||||
path := gameDir + entry.Name()
|
||||
@@ -143,10 +143,12 @@ func checkBrokenSongs() {
|
||||
if err != nil {
|
||||
//File not found
|
||||
brokenSongs = append(brokenSongs, song)
|
||||
}
|
||||
fmt.Printf("song broken: %v", song.Path)
|
||||
} else {
|
||||
err = openFile.Close()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
db.RemoveBrokenSongs(brokenSongs)
|
||||
|
||||
Reference in New Issue
Block a user