Added exclude patterns support for Clean Task (#274)

* Added exclude patterns support for Clean Task

* Added test file

* Refactoring and cosmetic fixes

* * Replace Match with MatchString
This commit is contained in:
bnkai
2019-12-24 04:06:07 +02:00
committed by Leopere
parent f52db4f58b
commit 52dd0197ee
6 changed files with 202 additions and 119 deletions

View File

@@ -21,8 +21,12 @@ func (t *CleanTask) Start(wg *sync.WaitGroup) {
if t.fileExists(t.Scene.Path) && t.pathInStash() {
logger.Debugf("File Found: %s", t.Scene.Path)
if matchFile(t.Scene.Path, config.GetExcludes()) {
logger.Infof("File matched regex. Cleaning: \"%s\"", t.Scene.Path)
t.deleteScene(t.Scene.ID)
}
} else {
logger.Infof("File not found. Cleaning: %s", t.Scene.Path)
logger.Infof("File not found. Cleaning: \"%s\"", t.Scene.Path)
t.deleteScene(t.Scene.ID)
}
}