mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:59:03 +00:00
23 lines
603 B
Go
23 lines
603 B
Go
package cleanup_tasks
|
|
|
|
import (
|
|
"github.com/photoview/photoview/api/graphql/models"
|
|
"github.com/photoview/photoview/api/scanner/scanner_task"
|
|
"github.com/photoview/photoview/api/scanner/scanner_utils"
|
|
)
|
|
|
|
type MediaCleanupTask struct {
|
|
scanner_task.ScannerTaskBase
|
|
}
|
|
|
|
func (t MediaCleanupTask) AfterScanAlbum(ctx scanner_task.TaskContext, changedMedia []*models.Media,
|
|
albumMedia []*models.Media) error {
|
|
|
|
cleanupErrors := CleanupMedia(ctx.GetDB(), ctx.GetAlbum().ID, albumMedia)
|
|
for _, err := range cleanupErrors {
|
|
scanner_utils.ScannerError(ctx, "delete old media: %s", err)
|
|
}
|
|
|
|
return nil
|
|
}
|