Make "-convert" suffix optional with checkbox (off by default)
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
8896206b68
commit
19739b0fab
13
main.go
13
main.go
|
|
@ -541,6 +541,7 @@ type convertConfig struct {
|
||||||
Mode string // Simple or Advanced
|
Mode string // Simple or Advanced
|
||||||
UseAutoNaming bool
|
UseAutoNaming bool
|
||||||
AutoNameTemplate string // Template for metadata-driven naming, e.g., "<actress> - <studio> - <scene>"
|
AutoNameTemplate string // Template for metadata-driven naming, e.g., "<actress> - <studio> - <scene>"
|
||||||
|
AppendSuffix bool // Append "-convert" suffix to output filename (off by default)
|
||||||
PreserveChapters bool
|
PreserveChapters bool
|
||||||
|
|
||||||
// Video encoding settings
|
// Video encoding settings
|
||||||
|
|
@ -610,6 +611,7 @@ func defaultConvertConfig() convertConfig {
|
||||||
Mode: "Simple",
|
Mode: "Simple",
|
||||||
UseAutoNaming: false,
|
UseAutoNaming: false,
|
||||||
AutoNameTemplate: "<actress> - <studio> - <scene>",
|
AutoNameTemplate: "<actress> - <studio> - <scene>",
|
||||||
|
AppendSuffix: false, // Don't append "-convert" by default
|
||||||
PreserveChapters: true,
|
PreserveChapters: true,
|
||||||
|
|
||||||
VideoCodec: "H.264",
|
VideoCodec: "H.264",
|
||||||
|
|
@ -6621,6 +6623,14 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
applyAutoName(true)
|
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) {
|
inverseCheck := widget.NewCheck("Smart Inverse Telecine", func(checked bool) {
|
||||||
state.convert.InverseTelecine = checked
|
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}),
|
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
outputEntry,
|
outputEntry,
|
||||||
outputHintContainer,
|
outputHintContainer,
|
||||||
|
appendSuffixCheck,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
simpleEncodingSection,
|
simpleEncodingSection,
|
||||||
widget.NewLabelWithStyle("Target Resolution", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
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}),
|
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
outputEntry,
|
outputEntry,
|
||||||
outputHintContainer,
|
outputHintContainer,
|
||||||
|
appendSuffixCheck,
|
||||||
coverDisplay,
|
coverDisplay,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
advancedVideoEncodingBlock,
|
advancedVideoEncodingBlock,
|
||||||
|
|
@ -8355,6 +8367,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
setTargetFileSize(state.convert.TargetFileSize)
|
setTargetFileSize(state.convert.TargetFileSize)
|
||||||
autoNameCheck.SetChecked(state.convert.UseAutoNaming)
|
autoNameCheck.SetChecked(state.convert.UseAutoNaming)
|
||||||
autoNameTemplate.SetText(state.convert.AutoNameTemplate)
|
autoNameTemplate.SetText(state.convert.AutoNameTemplate)
|
||||||
|
appendSuffixCheck.SetChecked(state.convert.AppendSuffix)
|
||||||
outputEntry.SetText(state.convert.OutputBase)
|
outputEntry.SetText(state.convert.OutputBase)
|
||||||
outputHint.SetText(fmt.Sprintf("Output file: %s", state.convert.OutputFile()))
|
outputHint.SetText(fmt.Sprintf("Output file: %s", state.convert.OutputFile()))
|
||||||
preserveChaptersCheck.SetChecked(state.convert.PreserveChapters)
|
preserveChaptersCheck.SetChecked(state.convert.PreserveChapters)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultOutputBase(src *videoSource) string {
|
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 {
|
if src == nil {
|
||||||
return "converted"
|
return "converted"
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +27,13 @@ func defaultOutputBase(src *videoSource) string {
|
||||||
// resolveOutputBase returns the output base for a source.
|
// 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.
|
// 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 {
|
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.
|
// Auto-naming overrides manual values.
|
||||||
if s.convert.UseAutoNaming && src != nil && strings.TrimSpace(s.convert.AutoNameTemplate) != "" {
|
if s.convert.UseAutoNaming && src != nil && strings.TrimSpace(s.convert.AutoNameTemplate) != "" {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user