diff --git a/TODO.md b/TODO.md index ee45932..5259cd9 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,2 @@ -## TODO: Don't show incompatible encoding options for encoders ## TODO: calculate total progress based on file sizes instead of counts of files for a more accurate progress percentage. ## TODO: when passing in a directory, list all video files in that directory and have the user choose which ones they want encoded diff --git a/app.go b/app.go index cd29c12..ddf8ccb 100644 --- a/app.go +++ b/app.go @@ -224,10 +224,39 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } +func parseConfig(cfg map[int]Config) ParsedConfig { + vEncoder := find(cfg, "Video Encoder") + aEncoder := find(cfg, "Audio Encoder") + preset := find(cfg, "Preset") + crf := find(cfg, "Constant Rate Factor (CRF)") + + return ParsedConfig{ + DeleteOldVideo: find(cfg, "Delete old video(s)?").FocusedOption != 0, + SkipEncodedVid: find(cfg, "What should we do about encoded videos?").FocusedOption == 0, + VideoEncoder: vEncoder.Opts[vEncoder.FocusedOption], + AudioEncoder: aEncoder.Opts[aEncoder.FocusedOption], + Preset: preset.Opts[preset.FocusedOption], + CRF: crf.Opts[crf.FocusedOption], + } +} + func CfgScreenView(m model) string { view := "" + config := parseConfig(m.Config) + for i, cfg := range Configs { + switch config.VideoEncoder { + case "copy", "librav1e": + if cfg.Name == "Preset" || cfg.Name == "Constant Rate Factor (CRF)" { + continue + } + case "libvpx-vp9", "libsvtav1": + if cfg.Name == "Preset" { + continue + } + } + opts := "" for j, opt := range cfg.Opts {