mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Add filesystem based blob storage (#3187)
* 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
This commit is contained in:
@@ -194,22 +194,22 @@ func (f *handlerRequiredFilter) Accept(ctx context.Context, ff file.File) bool {
|
||||
}
|
||||
|
||||
if isVideoFile {
|
||||
// check if the screenshot file exists
|
||||
hash := scene.GetHash(ff, f.videoFileNamingAlgorithm)
|
||||
ssPath := instance.Paths.Scene.GetScreenshotPath(hash)
|
||||
if exists, _ := fsutil.FileExists(ssPath); !exists {
|
||||
// if not, check if the file is a primary file for a scene
|
||||
scenes, err := f.SceneFinder.FindByPrimaryFileID(ctx, ff.Base().ID)
|
||||
if err != nil {
|
||||
// just ignore
|
||||
return false
|
||||
}
|
||||
// TODO - check if the cover exists
|
||||
// hash := scene.GetHash(ff, f.videoFileNamingAlgorithm)
|
||||
// ssPath := instance.Paths.Scene.GetScreenshotPath(hash)
|
||||
// if exists, _ := fsutil.FileExists(ssPath); !exists {
|
||||
// // if not, check if the file is a primary file for a scene
|
||||
// scenes, err := f.SceneFinder.FindByPrimaryFileID(ctx, ff.Base().ID)
|
||||
// if err != nil {
|
||||
// // just ignore
|
||||
// return false
|
||||
// }
|
||||
|
||||
if len(scenes) > 0 {
|
||||
// if it is, then it needs to be re-generated
|
||||
return true
|
||||
}
|
||||
}
|
||||
// if len(scenes) > 0 {
|
||||
// // if it is, then it needs to be re-generated
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
|
||||
// clean captions - scene handler handles this as well, but
|
||||
// unchanged files aren't processed by the scene handler
|
||||
@@ -349,7 +349,6 @@ func getScanHandlers(options ScanMetadataInput, taskQueue *job.TaskQueue, progre
|
||||
CreatorUpdater: db.Scene,
|
||||
PluginCache: pluginCache,
|
||||
CaptionUpdater: db.File,
|
||||
CoverGenerator: &coverGenerator{},
|
||||
ScanGenerator: &sceneGenerators{
|
||||
input: options,
|
||||
taskQueue: taskQueue,
|
||||
@@ -485,5 +484,17 @@ func (g *sceneGenerators) Generate(ctx context.Context, s *models.Scene, f *file
|
||||
}
|
||||
}
|
||||
|
||||
if t.ScanGenerateCovers {
|
||||
progress.AddTotal(1)
|
||||
g.taskQueue.Add(fmt.Sprintf("Generating cover for %s", path), func(ctx context.Context) {
|
||||
taskCover := GenerateCoverTask{
|
||||
Scene: *s,
|
||||
txnManager: instance.Repository,
|
||||
}
|
||||
taskCover.Start(ctx)
|
||||
progress.Increment()
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user