Fix merge job clip extraction

This commit is contained in:
Stu Leak 2025-12-11 09:16:39 -05:00
parent 16217600b1
commit 1e3e213964

11
main.go
View File

@ -1923,7 +1923,9 @@ func (s *appState) executeMergeJob(ctx context.Context, job *queue.Job, progress
outputPath, _ := cfg["outputPath"].(string) outputPath, _ := cfg["outputPath"].(string)
rawClips, _ := cfg["clips"].([]interface{}) rawClips, _ := cfg["clips"].([]interface{})
rawClipMaps, _ := cfg["clips"].([]map[string]interface{})
var clips []mergeClip var clips []mergeClip
if len(rawClips) > 0 {
for _, rc := range rawClips { for _, rc := range rawClips {
if m, ok := rc.(map[string]interface{}); ok { if m, ok := rc.(map[string]interface{}); ok {
clips = append(clips, mergeClip{ clips = append(clips, mergeClip{
@ -1933,6 +1935,15 @@ func (s *appState) executeMergeJob(ctx context.Context, job *queue.Job, progress
}) })
} }
} }
} else if len(rawClipMaps) > 0 {
for _, m := range rawClipMaps {
clips = append(clips, mergeClip{
Path: toString(m["path"]),
Chapter: toString(m["chapter"]),
Duration: toFloat(m["duration"]),
})
}
}
if len(clips) < 2 { if len(clips) < 2 {
return fmt.Errorf("need at least two clips to merge") return fmt.Errorf("need at least two clips to merge")
} }