mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user