mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Refactor transaction hooks. Add preCommit * Add BlobStore * Use blobStore for tag images * Use blobStore for studio images * Use blobStore for performer images * Use blobStore for scene covers * Don't generate screenshots in legacy directory * Run post-hooks outside original transaction * Use blobStore for movie images * Remove unnecessary DestroyImage methods * Add missing filter for scene cover * Add covers to generate options * Add generate cover option to UI * Add screenshot migration * Delete thumb files as part of screenshot migration
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/stashapp/stash/internal/manager"
|
|
"github.com/stashapp/stash/internal/manager/task"
|
|
"github.com/stashapp/stash/pkg/scene"
|
|
"github.com/stashapp/stash/pkg/utils"
|
|
)
|
|
|
|
func (r *mutationResolver) MigrateSceneScreenshots(ctx context.Context, input MigrateSceneScreenshotsInput) (string, error) {
|
|
db := manager.GetInstance().Database
|
|
t := &task.MigrateSceneScreenshotsJob{
|
|
ScreenshotsPath: manager.GetInstance().Paths.Generated.Screenshots,
|
|
Input: scene.MigrateSceneScreenshotsInput{
|
|
DeleteFiles: utils.IsTrue(input.DeleteFiles),
|
|
OverwriteExisting: utils.IsTrue(input.OverwriteExisting),
|
|
},
|
|
SceneRepo: db.Scene,
|
|
TxnManager: db,
|
|
}
|
|
jobID := manager.GetInstance().JobManager.Add(ctx, "Migrating scene screenshots to blobs...", t)
|
|
|
|
return strconv.Itoa(jobID), nil
|
|
}
|
|
|
|
func (r *mutationResolver) MigrateBlobs(ctx context.Context, input MigrateBlobsInput) (string, error) {
|
|
db := manager.GetInstance().Database
|
|
t := &task.MigrateBlobsJob{
|
|
TxnManager: db,
|
|
BlobStore: db.Blobs,
|
|
Vacuumer: db,
|
|
DeleteOld: utils.IsTrue(input.DeleteOld),
|
|
}
|
|
jobID := manager.GetInstance().JobManager.Add(ctx, "Migrating blobs...", t)
|
|
|
|
return strconv.Itoa(jobID), nil
|
|
}
|