Add Clean generated files task (#4607)

* Add clean generate task
* Add to library tasks
* Save and read defaults
* Stop handling and logging
* Make filename parsing more robust
This commit is contained in:
WithoutPants
2024-02-23 15:56:00 +11:00
committed by GitHub
parent 4a3ce8b6ec
commit ba1ebba6c0
16 changed files with 994 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/stashapp/stash/internal/identify"
"github.com/stashapp/stash/internal/manager"
"github.com/stashapp/stash/internal/manager/config"
"github.com/stashapp/stash/internal/manager/task"
"github.com/stashapp/stash/pkg/logger"
)
@@ -98,6 +99,21 @@ func (r *mutationResolver) MetadataClean(ctx context.Context, input manager.Clea
return strconv.Itoa(jobID), nil
}
func (r *mutationResolver) MetadataCleanGenerated(ctx context.Context, input task.CleanGeneratedOptions) (string, error) {
mgr := manager.GetInstance()
t := &task.CleanGeneratedJob{
Options: input,
Paths: mgr.Paths,
BlobsStorageType: mgr.Config.GetBlobsStorage(),
VideoFileNamingAlgorithm: mgr.Config.GetVideoFileNamingAlgorithm(),
Repository: mgr.Repository,
BlobCleaner: mgr.Repository.Blob,
}
jobID := mgr.JobManager.Add(ctx, "Cleaning generated files...", t)
return strconv.Itoa(jobID), nil
}
func (r *mutationResolver) MigrateHashNaming(ctx context.Context) (string, error) {
jobID := manager.GetInstance().MigrateHash(ctx)
return strconv.Itoa(jobID), nil