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{}