Fix image clean (#913)

* Use correct regex when cleaning images
* Clarify video exclusion pattern heading
This commit is contained in:
WithoutPants 2020-11-03 09:34:53 +11:00 committed by GitHub
parent bae82513eb
commit cbfd9e82b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View file

@ -41,13 +41,7 @@ func (t *CleanTask) shouldClean(path string) bool {
// use image.FileExists for zip file checking
fileExists := image.FileExists(path)
if fileExists && t.getStashFromPath(path) != nil {
logger.Debugf("File Found: %s", path)
if matchFile(path, config.GetExcludes()) {
logger.Infof("File matched regex. Cleaning: \"%s\"", path)
return true
}
} else {
if !fileExists || t.getStashFromPath(path) == nil {
logger.Infof("File not found. Cleaning: \"%s\"", path)
return true
}
@ -71,6 +65,11 @@ func (t *CleanTask) shouldCleanScene(s *models.Scene) bool {
return true
}
if matchFile(s.Path, config.GetExcludes()) {
logger.Infof("File matched regex. Cleaning: \"%s\"", s.Path)
return true
}
return false
}
@ -96,6 +95,11 @@ func (t *CleanTask) shouldCleanGallery(g *models.Gallery) bool {
return true
}
if matchFile(path, config.GetImageExcludes()) {
logger.Infof("File matched regex. Cleaning: \"%s\"", path)
return true
}
if countImagesInZip(path) == 0 {
logger.Infof("Gallery has 0 images. Cleaning: \"%s\"", path)
return true
@ -120,6 +124,11 @@ func (t *CleanTask) shouldCleanImage(s *models.Image) bool {
return true
}
if matchFile(s.Path, config.GetImageExcludes()) {
logger.Infof("File matched regex. Cleaning: \"%s\"", s.Path)
return true
}
return false
}

View file

@ -423,7 +423,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
</Form.Group>
<Form.Group>
<h6>Excluded Patterns</h6>
<h6>Excluded Video Patterns</h6>
<ExclusionPatterns excludes={excludes} setExcludes={setExcludes} />
<Form.Text className="text-muted">
Regexps of video files/paths to exclude from Scan and add to Clean