album update after tag changes with no folder update

This commit is contained in:
sentriz
2020-12-30 21:51:59 +00:00
parent a37993e24f
commit b1543fc524
2 changed files with 4 additions and 7 deletions

View File

@@ -177,8 +177,7 @@ type Album struct {
Tracks []*Track Tracks []*Track
ChildCount int `sql:"-"` ChildCount int `sql:"-"`
Duration int `sql:"-"` Duration int `sql:"-"`
ReceivedPaths bool `gorm:"-"` ShouldSave bool `sql:"-"`
ReceivedTags bool `gorm:"-"`
} }
func (a *Album) SID() *specid.ID { func (a *Album) SID() *specid.ID {

View File

@@ -325,7 +325,7 @@ func (s *Scanner) callbackPost(fullPath string, info *godirwalk.Dirent) error {
// begin taking the current folder off the stack and add it's // begin taking the current folder off the stack and add it's
// parent, cover that we found, etc. // parent, cover that we found, etc.
folder := s.curFolders.Pop() folder := s.curFolders.Pop()
if !folder.ReceivedPaths { if !folder.ShouldSave {
return nil return nil
} }
folder.ParentID = s.curFolders.PeekID() folder.ParentID = s.curFolders.PeekID()
@@ -384,7 +384,6 @@ func (s *Scanner) handleFolder(it *item) error {
if err := s.db.Save(folder).Error; err != nil { if err := s.db.Save(folder).Error; err != nil {
return fmt.Errorf("writing albums table: %w", err) return fmt.Errorf("writing albums table: %w", err)
} }
folder.ReceivedPaths = true
return nil return nil
} }
@@ -479,8 +478,7 @@ func (s *Scanner) handleTrack(it *item) error {
// ** begin set album if this is the first track in the folder // ** begin set album if this is the first track in the folder
folder := s.curFolders.Peek() folder := s.curFolders.Peek()
if !folder.ReceivedPaths || folder.ReceivedTags { if folder.ShouldSave {
// the folder hasn't been modified or already has it's tags
return nil return nil
} }
err = s.trTx. err = s.trTx.
@@ -504,7 +502,7 @@ func (s *Scanner) handleTrack(it *item) error {
folder.TagBrainzID = trTags.AlbumBrainzID() folder.TagBrainzID = trTags.AlbumBrainzID()
folder.TagYear = trTags.Year() folder.TagYear = trTags.Year()
folder.TagArtistID = artist.ID folder.TagArtistID = artist.ID
folder.ReceivedTags = true folder.ShouldSave = true
return nil return nil
} }