Process empty folders as changed folders

This is a workaround for rclone not changing the directory modtime when you delete all folders from it (happens when you are moveing things around with beets)
This commit is contained in:
Deluan 2020-11-01 23:25:34 -05:00 committed by Joe Stump
parent 8c0cbeffbb
commit c6534e213a
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -185,8 +185,8 @@ func (s *TagScanner) getDBDirTree(ctx context.Context) (map[string]struct{}, err
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)
// If is a new folder with at least one song OR it is empty OR it was modified after lastModified
return (!inDB && (folder.AudioFilesCount > 0)) || folder.AudioFilesCount == 0 || folder.ModTime.After(lastModified)
}
func (s *TagScanner) getDeletedDirs(ctx context.Context, fsDirs dirMap, dbDirs map[string]struct{}) []string {