Handle file rescan (#2951)

* Fire handlers when file updated or moved
* Create galleries as needed
* Clean empty galleries
* Handle cleaning zip folders when path changed
* Fix gallery association on duplicate images
* Re-create missing folder-based galleries
This commit is contained in:
WithoutPants
2022-09-28 16:08:00 +10:00
committed by GitHub
parent 00820a8789
commit dce90a3ed9
13 changed files with 439 additions and 106 deletions

View File

@@ -29,7 +29,7 @@ func (ff FilterFunc) Accept(ctx context.Context, f File) bool {
// Handler provides a handler for Files.
type Handler interface {
Handle(ctx context.Context, f File) error
Handle(ctx context.Context, f File, oldFile File) error
}
// FilteredHandler is a Handler runs only if the filter accepts the file.
@@ -39,9 +39,9 @@ type FilteredHandler struct {
}
// Handle runs the handler if the filter accepts the file.
func (h *FilteredHandler) Handle(ctx context.Context, f File) error {
func (h *FilteredHandler) Handle(ctx context.Context, f File, oldFile File) error {
if h.Accept(ctx, f) {
return h.Handler.Handle(ctx, f)
return h.Handler.Handle(ctx, f, oldFile)
}
return nil
}