Folder Gallery creation on a per folder basis (#3715)

* GalleryInExClusion // Create Gallery from folder based on file, short description in setting
* GalleryInExClusion // No Folderiteration, expansion of docs
* GalleryInExClusion // Only accept lowercase files
* GalleryInExClusion // Correct text in settings
This commit is contained in:
yoshnopa
2023-05-10 03:37:01 +02:00
committed by GitHub
parent 61c0098ae6
commit 0069c48e7e
3 changed files with 31 additions and 3 deletions

View File

@@ -307,7 +307,23 @@ func (h *ScanHandler) getOrCreateGallery(ctx context.Context, f file.File) (*mod
return h.getOrCreateZipBasedGallery(ctx, f.Base().ZipFile)
}
if h.ScanConfig.GetCreateGalleriesFromFolders() {
// Look for specific filename in Folder to find out if the Folder is marked to be handled differently as the setting
folderPath := filepath.Dir(f.Base().Path)
forceGallery := false
if _, err := os.Stat(filepath.Join(folderPath, ".forcegallery")); err == nil {
forceGallery = true
} else if !errors.Is(err, os.ErrNotExist) {
return nil, fmt.Errorf("Could not test Path %s: %w", folderPath, err)
}
exemptGallery := false
if _, err := os.Stat(filepath.Join(folderPath, ".nogallery")); err == nil {
exemptGallery = true
} else if !errors.Is(err, os.ErrNotExist) {
return nil, fmt.Errorf("Could not test Path %s: %w", folderPath, err)
}
if forceGallery || (h.ScanConfig.GetCreateGalleriesFromFolders() && !exemptGallery) {
return h.getOrCreateFolderBasedGallery(ctx, f)
}