Fix queue deserialization for formatOption struct
Handle case where formatOption is loaded from JSON as a map instead of a struct. This prevents panic when reloading saved queue on startup.
This commit is contained in:
parent
d64871c208
commit
39a73a86d6
21
main.go
21
main.go
|
|
@ -887,7 +887,26 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format-specific settings
|
// Format-specific settings
|
||||||
selectedFormat := cfg["selectedFormat"].(formatOption)
|
var selectedFormat formatOption
|
||||||
|
switch v := cfg["selectedFormat"].(type) {
|
||||||
|
case formatOption:
|
||||||
|
selectedFormat = v
|
||||||
|
case map[string]interface{}:
|
||||||
|
// Reconstruct from map (happens when loading from JSON)
|
||||||
|
if label, ok := v["Label"].(string); ok {
|
||||||
|
selectedFormat.Label = label
|
||||||
|
}
|
||||||
|
if ext, ok := v["Ext"].(string); ok {
|
||||||
|
selectedFormat.Ext = ext
|
||||||
|
}
|
||||||
|
if codec, ok := v["VideoCodec"].(string); ok {
|
||||||
|
selectedFormat.VideoCodec = codec
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// Fallback to MP4
|
||||||
|
selectedFormat = formatOptions[0]
|
||||||
|
}
|
||||||
|
|
||||||
if strings.EqualFold(selectedFormat.Ext, ".mp4") || strings.EqualFold(selectedFormat.Ext, ".mov") {
|
if strings.EqualFold(selectedFormat.Ext, ".mp4") || strings.EqualFold(selectedFormat.Ext, ".mov") {
|
||||||
args = append(args, "-movflags", "+faststart")
|
args = append(args, "-movflags", "+faststart")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user