mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Clamp generator parameters (#2319)
This commit is contained in:
@@ -114,6 +114,15 @@ func (g *GeneratorInfo) configure() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #2250 - ensure ChunkCount and ChunkDuration are valid
|
||||||
|
if g.ChunkCount < 1 {
|
||||||
|
logger.Warnf("[generator] Segment count (%d) must be > 0. Using 1 instead.", g.ChunkCount)
|
||||||
|
g.ChunkCount = 1
|
||||||
|
}
|
||||||
|
if g.ChunkDuration < 0.75 {
|
||||||
|
logger.Warnf("[generator] Segment duration (%f) must be >= 0.75. Using 0.75 instead.", g.ChunkDuration)
|
||||||
|
g.ChunkDuration = 0.75
|
||||||
|
}
|
||||||
g.NthFrame = g.NumberOfFrames / g.ChunkCount
|
g.NthFrame = g.NumberOfFrames / g.ChunkCount
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -47,11 +47,12 @@ export const VideoPreviewInput: React.FC<IVideoPreviewInput> = ({
|
|||||||
<Form.Control
|
<Form.Control
|
||||||
className="text-input"
|
className="text-input"
|
||||||
type="number"
|
type="number"
|
||||||
value={previewSegments?.toString() ?? 0}
|
value={previewSegments?.toString() ?? 1}
|
||||||
|
min={1}
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
set({
|
set({
|
||||||
previewSegments: Number.parseInt(
|
previewSegments: Number.parseInt(
|
||||||
e.currentTarget.value || "0",
|
e.currentTarget.value || "1",
|
||||||
10
|
10
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user