Shortcut scan walk for excluded folders (#1382)

* Shortcut scan walk for excluded folders
* Add note to manual
* Add changelog entry
This commit is contained in:
WithoutPants
2021-05-17 15:46:00 +10:00
committed by GitHub
parent aba2514534
commit 3df7ee06eb
3 changed files with 10 additions and 0 deletions

View File

@@ -1098,6 +1098,13 @@ func walkFilesToScan(s *models.StashConfig, f filepath.WalkFunc) error {
return filepath.SkipDir
}
// shortcut: skip the directory entirely if it matches both exclusion patterns
// add a trailing separator so that it correctly matches against patterns like path/.*
pathExcludeTest := path + string(filepath.Separator)
if (s.ExcludeVideo || matchFileRegex(pathExcludeTest, excludeVidRegex)) && (s.ExcludeImage || matchFileRegex(pathExcludeTest, excludeImgRegex)) {
return filepath.SkipDir
}
return nil
}

View File

@@ -1,2 +1,3 @@
### 🎨 Improvements
* Skip scanning directories if path matches image and video exclude patterns. ([#1382](https://github.com/stashapp/stash/pull/1382))
* Add button to remove studio stash ID. ([#1378](https://github.com/stashapp/stash/pull/1378))

View File

@@ -32,6 +32,8 @@ exclude:
* the fourth the directory `/stash/videos/exclude/`
* and the last a windows network path `\\stash\network\share\excl\`
**Note:** if a directory is excluded for images and videos, then the directory will be excluded from scans completely.
_a useful [link](https://regex101.com/) to experiment with regexps_
## Hashing algorithms