mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Change handlerRequiredFilter to check for .forcegallery (#4627)
This commit is contained in:
parent
48c287ed76
commit
3a56dd98db
1 changed files with 17 additions and 2 deletions
|
|
@ -176,7 +176,8 @@ func (f *handlerRequiredFilter) Accept(ctx context.Context, ff models.File) bool
|
||||||
// if create galleries from folder is enabled and the file is not in a zip
|
// if create galleries from folder is enabled and the file is not in a zip
|
||||||
// file, then check if there is a folder-based gallery for the file's
|
// file, then check if there is a folder-based gallery for the file's
|
||||||
// directory
|
// directory
|
||||||
if isImageFile && instance.Config.GetCreateGalleriesFromFolders() && ff.Base().ZipFileID == nil {
|
// #4611 - also check for .forcegallery
|
||||||
|
if isImageFile && ff.Base().ZipFileID == nil {
|
||||||
// only do this for the first time it encounters the folder
|
// only do this for the first time it encounters the folder
|
||||||
// the first instance should create the gallery
|
// the first instance should create the gallery
|
||||||
_, found := f.FolderCache.Get(ctx, ff.Base().ParentFolderID.String())
|
_, found := f.FolderCache.Get(ctx, ff.Base().ParentFolderID.String())
|
||||||
|
|
@ -185,9 +186,23 @@ func (f *handlerRequiredFilter) Accept(ctx context.Context, ff models.File) bool
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
g, _ := f.GalleryFinder.FindByFolderID(ctx, ff.Base().ParentFolderID)
|
|
||||||
f.FolderCache.Add(ctx, ff.Base().ParentFolderID.String(), true)
|
f.FolderCache.Add(ctx, ff.Base().ParentFolderID.String(), true)
|
||||||
|
|
||||||
|
createGallery := instance.Config.GetCreateGalleriesFromFolders()
|
||||||
|
if !createGallery {
|
||||||
|
// check for presence of .forcegallery
|
||||||
|
forceGalleryPath := filepath.Join(filepath.Dir(path), ".forcegallery")
|
||||||
|
if exists, _ := fsutil.FileExists(forceGalleryPath); exists {
|
||||||
|
createGallery = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !createGallery {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
g, _ := f.GalleryFinder.FindByFolderID(ctx, ff.Base().ParentFolderID)
|
||||||
|
|
||||||
if len(g) == 0 {
|
if len(g) == 0 {
|
||||||
// no folder gallery. Return true so that it creates one.
|
// no folder gallery. Return true so that it creates one.
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue