fix: only update artists and albums if there were any changes in files

This commit is contained in:
Deluan 2020-02-12 23:05:10 -05:00
parent 9fa73e3b7b
commit edb839a41d
1 changed files with 3 additions and 3 deletions

View File

@ -144,8 +144,6 @@ func (s *TagScanner) processChangedDir(ctx context.Context, dir string, updatedA
}
for _, t := range ct {
currentTracks[t.ID] = t
updatedArtists[t.ArtistID] = true
updatedAlbums[t.AlbumID] = true
}
// Load tracks from the folder
@ -178,8 +176,10 @@ func (s *TagScanner) processChangedDir(ctx context.Context, dir string, updatedA
}
// Remaining tracks from DB that are not in the folder are deleted
for id := range currentTracks {
for id, ct := range currentTracks {
numPurgedTracks++
updatedArtists[ct.ArtistID] = true
updatedAlbums[ct.AlbumID] = true
if err := s.ds.MediaFile(ctx).Delete(id); err != nil {
return err
}