Better naming for function

This commit is contained in:
Deluan 2020-10-30 13:14:53 -04:00 committed by Joe Stump
parent 28ad4205e4
commit 44c1072ca0
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -88,7 +88,7 @@ func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) erro
}
allFSDirs[folderStats.Path] = folderStats
if s.isChangedDirs(ctx, folderStats, allDBDirs, lastModifiedSince) {
if s.folderHasChanged(ctx, folderStats, allDBDirs, lastModifiedSince) {
changedDirs = append(changedDirs, folderStats.Path)
log.Debug("Processing changed folder", "dir", folderStats.Path)
err := s.processChangedDir(ctx, folderStats.Path)
@ -174,7 +174,7 @@ func (s *TagScanner) getDBDirTree(ctx context.Context) (map[string]struct{}, err
return resp, nil
}
func (s *TagScanner) isChangedDirs(ctx context.Context, folder dirStats, dbDirs map[string]struct{}, lastModified time.Time) bool {
func (s *TagScanner) folderHasChanged(ctx context.Context, folder dirStats, dbDirs map[string]struct{}, lastModified time.Time) bool {
_, inDB := dbDirs[folder.Path]
// If is a new folder with at least one song OR it was modified after lastModified
return (!inDB && (folder.AudioFilesCount > 0)) || folder.ModTime.After(lastModified)