mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Fix image clean (#913)
* Use correct regex when cleaning images * Clarify video exclusion pattern heading
This commit is contained in:
@@ -41,13 +41,7 @@ func (t *CleanTask) shouldClean(path string) bool {
|
|||||||
// use image.FileExists for zip file checking
|
// use image.FileExists for zip file checking
|
||||||
fileExists := image.FileExists(path)
|
fileExists := image.FileExists(path)
|
||||||
|
|
||||||
if fileExists && t.getStashFromPath(path) != nil {
|
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 {
|
|
||||||
logger.Infof("File not found. Cleaning: \"%s\"", path)
|
logger.Infof("File not found. Cleaning: \"%s\"", path)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -71,6 +65,11 @@ func (t *CleanTask) shouldCleanScene(s *models.Scene) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matchFile(s.Path, config.GetExcludes()) {
|
||||||
|
logger.Infof("File matched regex. Cleaning: \"%s\"", s.Path)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +95,11 @@ func (t *CleanTask) shouldCleanGallery(g *models.Gallery) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matchFile(path, config.GetImageExcludes()) {
|
||||||
|
logger.Infof("File matched regex. Cleaning: \"%s\"", path)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
if countImagesInZip(path) == 0 {
|
if countImagesInZip(path) == 0 {
|
||||||
logger.Infof("Gallery has 0 images. Cleaning: \"%s\"", path)
|
logger.Infof("Gallery has 0 images. Cleaning: \"%s\"", path)
|
||||||
return true
|
return true
|
||||||
@@ -120,6 +124,11 @@ func (t *CleanTask) shouldCleanImage(s *models.Image) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matchFile(s.Path, config.GetImageExcludes()) {
|
||||||
|
logger.Infof("File matched regex. Cleaning: \"%s\"", s.Path)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ export const SettingsConfigurationPanel: React.FC = () => {
|
|||||||
</Form.Group>
|
</Form.Group>
|
||||||
|
|
||||||
<Form.Group>
|
<Form.Group>
|
||||||
<h6>Excluded Patterns</h6>
|
<h6>Excluded Video Patterns</h6>
|
||||||
<ExclusionPatterns excludes={excludes} setExcludes={setExcludes} />
|
<ExclusionPatterns excludes={excludes} setExcludes={setExcludes} />
|
||||||
<Form.Text className="text-muted">
|
<Form.Text className="text-muted">
|
||||||
Regexps of video files/paths to exclude from Scan and add to Clean
|
Regexps of video files/paths to exclude from Scan and add to Clean
|
||||||
|
|||||||
Reference in New Issue
Block a user