mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Allow customisation of preview generation (#673)
* Add generate-specific options * Include no-cache in preview response
This commit is contained in:
@@ -167,6 +167,33 @@ func (s *singleton) Export() {
|
||||
}()
|
||||
}
|
||||
|
||||
func setGeneratePreviewOptionsInput(optionsInput *models.GeneratePreviewOptionsInput) {
|
||||
if optionsInput.PreviewSegments == nil {
|
||||
val := config.GetPreviewSegments()
|
||||
optionsInput.PreviewSegments = &val
|
||||
}
|
||||
|
||||
if optionsInput.PreviewSegmentDuration == nil {
|
||||
val := config.GetPreviewSegmentDuration()
|
||||
optionsInput.PreviewSegmentDuration = &val
|
||||
}
|
||||
|
||||
if optionsInput.PreviewExcludeStart == nil {
|
||||
val := config.GetPreviewExcludeStart()
|
||||
optionsInput.PreviewExcludeStart = &val
|
||||
}
|
||||
|
||||
if optionsInput.PreviewExcludeEnd == nil {
|
||||
val := config.GetPreviewExcludeEnd()
|
||||
optionsInput.PreviewExcludeEnd = &val
|
||||
}
|
||||
|
||||
if optionsInput.PreviewPreset == nil {
|
||||
val := config.GetPreviewPreset()
|
||||
optionsInput.PreviewPreset = &val
|
||||
}
|
||||
}
|
||||
|
||||
func (s *singleton) Generate(input models.GenerateMetadataInput) {
|
||||
if s.Status.Status != Idle {
|
||||
return
|
||||
@@ -181,8 +208,6 @@ func (s *singleton) Generate(input models.GenerateMetadataInput) {
|
||||
//this.job.total = await ObjectionUtils.getCount(Scene);
|
||||
instance.Paths.Generated.EnsureTmpDir()
|
||||
|
||||
preset := config.GetPreviewPreset().String()
|
||||
|
||||
galleryIDs := utils.StringSliceToIntSlice(input.GalleryIDs)
|
||||
sceneIDs := utils.StringSliceToIntSlice(input.SceneIDs)
|
||||
markerIDs := utils.StringSliceToIntSlice(input.MarkerIDs)
|
||||
@@ -251,6 +276,12 @@ func (s *singleton) Generate(input models.GenerateMetadataInput) {
|
||||
overwrite = *input.Overwrite
|
||||
}
|
||||
|
||||
generatePreviewOptions := input.PreviewOptions
|
||||
if generatePreviewOptions == nil {
|
||||
generatePreviewOptions = &models.GeneratePreviewOptionsInput{}
|
||||
}
|
||||
setGeneratePreviewOptionsInput(generatePreviewOptions)
|
||||
|
||||
for i, scene := range scenes {
|
||||
s.Status.setProgress(i, total)
|
||||
if s.Status.stopping {
|
||||
@@ -276,7 +307,12 @@ func (s *singleton) Generate(input models.GenerateMetadataInput) {
|
||||
}
|
||||
|
||||
if input.Previews {
|
||||
task := GeneratePreviewTask{Scene: *scene, ImagePreview: input.ImagePreviews, PreviewPreset: preset, Overwrite: overwrite}
|
||||
task := GeneratePreviewTask{
|
||||
Scene: *scene,
|
||||
ImagePreview: input.ImagePreviews,
|
||||
Options: *generatePreviewOptions,
|
||||
Overwrite: overwrite,
|
||||
}
|
||||
go task.Start(&wg)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user