Use default duration on zero-interval markers; trim setting copy

The marker form already permits end == start, so refusing to render in
the generator was an inconsistent gate. Treat non-positive intervals the
same as a missing end (fall back to markerPreviewDefaultDuration) while
keeping the warning log for visibility into unexpected data.

Also trims the max_marker_preview_duration_desc copy to match the tone
of neighboring setting descriptions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Speck Pratt 2026-04-29 08:34:44 -04:00
parent ebca98b46f
commit 9f8acb2b79
2 changed files with 8 additions and 10 deletions

View file

@ -37,18 +37,16 @@ func (g Generator) MarkerPreviewVideo(ctx context.Context, input string, hash st
duration := float64(markerPreviewDefaultDuration)
// Honor the marker's explicit interval when present and positive, capped
// by the configured safety ceiling. maxDuration <= 0 disables the ceiling.
// Non-positive intervals are treated as "no video wanted" and skipped —
// if the user intentionally set end = start they didn't want a preview,
// and if it's a data mistake we'd rather surface it than silently default.
// Honor the marker's explicit interval when present, capped by the configured
// safety ceiling. maxDuration <= 0 disables the ceiling. The marker form
// permits end == start, so a non-positive interval is treated the same as
// a missing end (fall back to the default duration) rather than refusing to
// render; the warning surfaces unexpected data without breaking generation.
if endSeconds != nil {
interval := *endSeconds - seconds
if interval <= 0 {
logger.Warnf("[generator] marker at %.2fs has non-positive interval (end=%.2f); skipping video preview generation", seconds, *endSeconds)
return nil
}
if maxDuration <= 0 || interval <= float64(maxDuration) {
logger.Warnf("[generator] marker at %.2fs has non-positive interval (end=%.2f); using default duration", seconds, *endSeconds)
} else if maxDuration <= 0 || interval <= float64(maxDuration) {
duration = interval
} else {
duration = float64(maxDuration)

View file

@ -418,7 +418,7 @@
"include_audio_desc": "Includes audio stream when generating previews.",
"include_audio_head": "Include audio",
"logging": "Logging",
"max_marker_preview_duration_desc": "Optional ceiling (in seconds) for marker preview videos with explicit end times. Default is 0 (no ceiling, the marker's end time is honored verbatim). Set a positive value to cap preview duration as a safety against imports or data entry mistakes. Markers without an end time use a fixed 20-second default, unaffected by this setting.",
"max_marker_preview_duration_desc": "Maximum duration (seconds) for marker previews. 0 disables the limit.",
"max_marker_preview_duration_head": "Max marker preview duration",
"maximum_streaming_transcode_size_desc": "Maximum size for transcoded streams.",
"maximum_streaming_transcode_size_head": "Maximum streaming transcode size",