From 19739b0fabd86c903b47ac82f825071c053bb0e2 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Tue, 30 Dec 2025 13:03:54 -0500 Subject: [PATCH] Make "-convert" suffix optional with checkbox (off by default) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added AppendSuffix bool field to convertConfig (default: false) - By default, output filename matches source filename exactly - Added checkbox "Append \"-convert\" to filename" (unchecked by default) - Checkbox appears in both Simple and Advanced modes - Eliminates noise when doing batch conversions - Auto-naming still works and respects the suffix setting Before: video.mp4 → video-convert.mp4 (always) After: video.mp4 → video.mp4 (or video-convert.mp4 if checked) Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- main.go | 13 +++++++++++++ naming_helpers.go | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 19fb73e..3c2c463 100644 --- a/main.go +++ b/main.go @@ -541,6 +541,7 @@ type convertConfig struct { Mode string // Simple or Advanced UseAutoNaming bool AutoNameTemplate string // Template for metadata-driven naming, e.g., " - - " + AppendSuffix bool // Append "-convert" suffix to output filename (off by default) PreserveChapters bool // Video encoding settings @@ -610,6 +611,7 @@ func defaultConvertConfig() convertConfig { Mode: "Simple", UseAutoNaming: false, AutoNameTemplate: " - - ", + AppendSuffix: false, // Don't append "-convert" by default PreserveChapters: true, VideoCodec: "H.264", @@ -6621,6 +6623,14 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { applyAutoName(true) } + appendSuffixCheck := widget.NewCheck("Append \"-convert\" to filename", func(checked bool) { + state.convert.AppendSuffix = checked + if !state.convert.UseAutoNaming { + applyAutoName(false) + } + }) + appendSuffixCheck.Checked = state.convert.AppendSuffix + inverseCheck := widget.NewCheck("Smart Inverse Telecine", func(checked bool) { state.convert.InverseTelecine = checked }) @@ -8229,6 +8239,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), outputEntry, outputHintContainer, + appendSuffixCheck, widget.NewSeparator(), simpleEncodingSection, widget.NewLabelWithStyle("Target Resolution", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), @@ -8291,6 +8302,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), outputEntry, outputHintContainer, + appendSuffixCheck, coverDisplay, widget.NewSeparator(), advancedVideoEncodingBlock, @@ -8355,6 +8367,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { setTargetFileSize(state.convert.TargetFileSize) autoNameCheck.SetChecked(state.convert.UseAutoNaming) autoNameTemplate.SetText(state.convert.AutoNameTemplate) + appendSuffixCheck.SetChecked(state.convert.AppendSuffix) outputEntry.SetText(state.convert.OutputBase) outputHint.SetText(fmt.Sprintf("Output file: %s", state.convert.OutputFile())) preserveChaptersCheck.SetChecked(state.convert.PreserveChapters) diff --git a/naming_helpers.go b/naming_helpers.go index dd6a9b7..1a02664 100644 --- a/naming_helpers.go +++ b/naming_helpers.go @@ -9,6 +9,14 @@ import ( ) func defaultOutputBase(src *videoSource) string { + if src == nil { + return "converted" + } + base := strings.TrimSuffix(src.DisplayName, filepath.Ext(src.DisplayName)) + return base +} + +func defaultOutputBaseWithSuffix(src *videoSource) string { if src == nil { return "converted" } @@ -19,7 +27,13 @@ func defaultOutputBase(src *videoSource) string { // resolveOutputBase returns the output base for a source. // keepExisting preserves manual edits when auto-naming is disabled; it is ignored when auto-naming is on. func (s *appState) resolveOutputBase(src *videoSource, keepExisting bool) string { - fallback := defaultOutputBase(src) + // Use suffix if AppendSuffix is enabled + var fallback string + if s.convert.AppendSuffix { + fallback = defaultOutputBaseWithSuffix(src) + } else { + fallback = defaultOutputBase(src) + } // Auto-naming overrides manual values. if s.convert.UseAutoNaming && src != nil && strings.TrimSpace(s.convert.AutoNameTemplate) != "" {