This commit is contained in:
sentriz
2019-05-17 13:14:51 +01:00
parent 7bbfef1638
commit 5c657d9630
13 changed files with 272 additions and 464 deletions

View File

@@ -126,13 +126,19 @@ func handleFolder(fullPath string, stat os.FileInfo) error {
func handleFolderCompletion(fullPath string, info *godirwalk.Dirent) error {
currentDir := currentDirStack.Peek()
defer currentDirStack.Pop()
if currentCover.NewlyInserted {
currentDir.CoverID = currentCover.ID
tx.Save(currentDir)
}
var dirShouldSave bool
if currentAlbum.ID != 0 {
currentAlbum.CoverID = currentCover.ID
tx.Save(currentAlbum)
currentDir.HasTracks = true
dirShouldSave = true
}
if currentCover.NewlyInserted {
currentDir.CoverID = currentCover.ID
dirShouldSave = true
}
if dirShouldSave {
tx.Save(currentDir)
}
currentCover = &db.Cover{}
currentAlbum = &db.Album{}

View File

@@ -140,7 +140,7 @@ func setAdminRoutes(cont handler.Controller, mux *http.ServeMux) {
}
func main() {
address := ":6969"
address := "0.0.0.0:6969"
mux := http.NewServeMux()
// create a new controller and pass a copy to both routes.
// they will add more fields to their copy if they need them