Add chapter removal option in Convert
This commit is contained in:
parent
ff612b547c
commit
e84dfd5eed
25
main.go
25
main.go
|
|
@ -504,6 +504,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>"
|
||||||
|
PreserveChapters bool
|
||||||
|
|
||||||
// Video encoding settings
|
// Video encoding settings
|
||||||
VideoCodec string // H.264, H.265, VP9, AV1, Copy
|
VideoCodec string // H.264, H.265, VP9, AV1, Copy
|
||||||
|
|
@ -572,6 +573,7 @@ func defaultConvertConfig() convertConfig {
|
||||||
Mode: "Simple",
|
Mode: "Simple",
|
||||||
UseAutoNaming: false,
|
UseAutoNaming: false,
|
||||||
AutoNameTemplate: "<actress> - <studio> - <scene>",
|
AutoNameTemplate: "<actress> - <studio> - <scene>",
|
||||||
|
PreserveChapters: true,
|
||||||
|
|
||||||
VideoCodec: "H.264",
|
VideoCodec: "H.264",
|
||||||
EncoderPreset: "slow",
|
EncoderPreset: "slow",
|
||||||
|
|
@ -1929,6 +1931,7 @@ func (s *appState) addConvertToQueueForSource(src *videoSource) error {
|
||||||
"selectedFormat": cfg.SelectedFormat,
|
"selectedFormat": cfg.SelectedFormat,
|
||||||
"quality": cfg.Quality,
|
"quality": cfg.Quality,
|
||||||
"mode": cfg.Mode,
|
"mode": cfg.Mode,
|
||||||
|
"preserveChapters": cfg.PreserveChapters,
|
||||||
"videoCodec": adjustedCodec,
|
"videoCodec": adjustedCodec,
|
||||||
"encoderPreset": cfg.EncoderPreset,
|
"encoderPreset": cfg.EncoderPreset,
|
||||||
"crf": cfg.CRF,
|
"crf": cfg.CRF,
|
||||||
|
|
@ -1965,6 +1968,7 @@ func (s *appState) addConvertToQueueForSource(src *videoSource) error {
|
||||||
"sourceWidth": src.Width,
|
"sourceWidth": src.Width,
|
||||||
"sourceHeight": src.Height,
|
"sourceHeight": src.Height,
|
||||||
"sourceDuration": src.Duration,
|
"sourceDuration": src.Duration,
|
||||||
|
"sourceBitrate": src.Bitrate,
|
||||||
"fieldOrder": src.FieldOrder,
|
"fieldOrder": src.FieldOrder,
|
||||||
"autoCompare": s.autoCompare, // Include auto-compare flag
|
"autoCompare": s.autoCompare, // Include auto-compare flag
|
||||||
}
|
}
|
||||||
|
|
@ -2674,6 +2678,7 @@ func (s *appState) batchAddToQueue(paths []string) {
|
||||||
"selectedFormat": s.convert.SelectedFormat,
|
"selectedFormat": s.convert.SelectedFormat,
|
||||||
"quality": s.convert.Quality,
|
"quality": s.convert.Quality,
|
||||||
"mode": s.convert.Mode,
|
"mode": s.convert.Mode,
|
||||||
|
"preserveChapters": s.convert.PreserveChapters,
|
||||||
"videoCodec": s.convert.VideoCodec,
|
"videoCodec": s.convert.VideoCodec,
|
||||||
"encoderPreset": s.convert.EncoderPreset,
|
"encoderPreset": s.convert.EncoderPreset,
|
||||||
"crf": s.convert.CRF,
|
"crf": s.convert.CRF,
|
||||||
|
|
@ -4112,7 +4117,16 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preserve chapters and metadata
|
// Preserve chapters and metadata
|
||||||
args = append(args, "-map_chapters", "0", "-map_metadata", "0")
|
preserveChapters := true
|
||||||
|
if v, ok := cfg["preserveChapters"].(bool); ok {
|
||||||
|
preserveChapters = v
|
||||||
|
}
|
||||||
|
if preserveChapters {
|
||||||
|
args = append(args, "-map_chapters", "0")
|
||||||
|
} else {
|
||||||
|
args = append(args, "-map_chapters", "-1")
|
||||||
|
}
|
||||||
|
args = append(args, "-map_metadata", "0")
|
||||||
|
|
||||||
// Copy subtitle streams by default (don't re-encode)
|
// Copy subtitle streams by default (don't re-encode)
|
||||||
args = append(args, "-c:s", "copy")
|
args = append(args, "-c:s", "copy")
|
||||||
|
|
@ -5892,6 +5906,12 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
dvdAspectBox := container.NewVBox(dvdAspectLabel, dvdAspectSelect, dvdInfoLabel)
|
dvdAspectBox := container.NewVBox(dvdAspectLabel, dvdAspectSelect, dvdInfoLabel)
|
||||||
dvdAspectBox.Hide() // Hidden by default
|
dvdAspectBox.Hide() // Hidden by default
|
||||||
|
|
||||||
|
// Chapter preservation
|
||||||
|
preserveChaptersCheck := widget.NewCheck("Keep chapters", func(checked bool) {
|
||||||
|
state.convert.PreserveChapters = checked
|
||||||
|
})
|
||||||
|
preserveChaptersCheck.SetChecked(state.convert.PreserveChapters)
|
||||||
|
|
||||||
// Placeholder for updateDVDOptions - will be defined after resolution/framerate selects are created
|
// Placeholder for updateDVDOptions - will be defined after resolution/framerate selects are created
|
||||||
var updateDVDOptions func()
|
var updateDVDOptions func()
|
||||||
|
|
||||||
|
|
@ -7615,6 +7635,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
widget.NewLabelWithStyle("Format", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Format", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
formatSelect,
|
formatSelect,
|
||||||
chapterWarningLabel, // Warning when converting chapters to DVD
|
chapterWarningLabel, // Warning when converting chapters to DVD
|
||||||
|
preserveChaptersCheck,
|
||||||
dvdAspectBox, // DVD options appear here when DVD format selected
|
dvdAspectBox, // DVD options appear here when DVD format selected
|
||||||
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
outputEntry,
|
outputEntry,
|
||||||
|
|
@ -7676,6 +7697,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
widget.NewLabelWithStyle("Format", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Format", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
formatSelect,
|
formatSelect,
|
||||||
chapterWarningLabel, // Warning when converting chapters to DVD
|
chapterWarningLabel, // Warning when converting chapters to DVD
|
||||||
|
preserveChaptersCheck,
|
||||||
dvdAspectBox, // DVD options appear here when DVD format selected
|
dvdAspectBox, // DVD options appear here when DVD format selected
|
||||||
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Output Name", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
outputEntry,
|
outputEntry,
|
||||||
|
|
@ -7746,6 +7768,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
|
||||||
autoNameTemplate.SetText(state.convert.AutoNameTemplate)
|
autoNameTemplate.SetText(state.convert.AutoNameTemplate)
|
||||||
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)
|
||||||
resolutionSelectSimple.SetSelected(state.convert.TargetResolution)
|
resolutionSelectSimple.SetSelected(state.convert.TargetResolution)
|
||||||
resolutionSelect.SetSelected(state.convert.TargetResolution)
|
resolutionSelect.SetSelected(state.convert.TargetResolution)
|
||||||
frameRateSelect.SetSelected(state.convert.FrameRate)
|
frameRateSelect.SetSelected(state.convert.FrameRate)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user