clearer(?) config name for when output file name conflicts with another

This commit is contained in:
2024-12-26 20:52:12 +02:00
parent 2e1d175e98
commit 1d456b9863
4 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -311,7 +311,7 @@ func parseConfig(cfg []Config) ParsedConfig {
return ParsedConfig{ return ParsedConfig{
DeleteOldVideo: find(cfg, "Delete old video(s)?").FocusedOption != 0, DeleteOldVideo: find(cfg, "Delete old video(s)?").FocusedOption != 0,
SkipEncodedVid: find(cfg, "What should we do about encoded videos?").FocusedOption == 0, IgnoreConflictingName: find(cfg, "On name conflict?").FocusedOption == 0,
VideoEncoder: vEncoder.Opts[vEncoder.FocusedOption], VideoEncoder: vEncoder.Opts[vEncoder.FocusedOption],
AudioEncoder: aEncoder.Opts[aEncoder.FocusedOption], AudioEncoder: aEncoder.Opts[aEncoder.FocusedOption],
Preset: preset.Opts[preset.FocusedOption], Preset: preset.Opts[preset.FocusedOption],
+1 -1
View File
@@ -99,7 +99,7 @@ func (m *Model) parseConfig(dryRun bool) tea.Cmd {
return parsedCfgMsg{ return parsedCfgMsg{
parsedConfig: ParsedConfig{ parsedConfig: ParsedConfig{
DeleteOldVideo: find(m.Config, "Delete old video(s)?").FocusedOption != 0, DeleteOldVideo: find(m.Config, "Delete old video(s)?").FocusedOption != 0,
SkipEncodedVid: find(m.Config, "What should we do about encoded videos?").FocusedOption == 0, IgnoreConflictingName: find(m.Config, "On name conflict?").FocusedOption == 0,
VideoEncoder: vEncoder.Opts[vEncoder.FocusedOption], VideoEncoder: vEncoder.Opts[vEncoder.FocusedOption],
AudioEncoder: aEncoder.Opts[aEncoder.FocusedOption], AudioEncoder: aEncoder.Opts[aEncoder.FocusedOption],
Preset: preset.Opts[preset.FocusedOption], Preset: preset.Opts[preset.FocusedOption],
+2 -2
View File
@@ -18,7 +18,7 @@ var SupportedAudioEncoders = []string{
var Configs = []Config{ var Configs = []Config{
{Name: "Delete old video(s)?", Opts: []string{"No", "Yes"}, FocusedOption: 1}, {Name: "Delete old video(s)?", Opts: []string{"No", "Yes"}, FocusedOption: 1},
{Name: "What should we do about encoded videos?", Opts: []string{"Skip", "Delete and encode again"}}, {Name: "On name conflict?", Opts: []string{"Ignore", "Overwrite"}},
{Name: "Video Encoder", Opts: []string{"copy"}}, {Name: "Video Encoder", Opts: []string{"copy"}},
{Name: "Audio Encoder", Opts: []string{"None", "copy"}, FocusedOption: 1}, {Name: "Audio Encoder", Opts: []string{"None", "copy"}, FocusedOption: 1},
{Name: "Preset", Opts: []string{"ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"}, FocusedOption: 4}, {Name: "Preset", Opts: []string{"ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"}, FocusedOption: 4},
@@ -33,7 +33,7 @@ type Config struct {
type ParsedConfig struct { type ParsedConfig struct {
DeleteOldVideo bool DeleteOldVideo bool
SkipEncodedVid bool IgnoreConflictingName bool
VideoEncoder string VideoEncoder string
AudioEncoder string AudioEncoder string
Preset string Preset string
+1 -1
View File
@@ -135,7 +135,7 @@ func encode(fullFilePath string, fileName string, teaP *tea.Program, cfg ParsedC
newFileFullPath := filepath.Join(parentDir, newFileName+fmt.Sprintf("_[%s]_[%s]", cfg.VideoEncoder, cfg.AudioEncoder)+extension) newFileFullPath := filepath.Join(parentDir, newFileName+fmt.Sprintf("_[%s]_[%s]", cfg.VideoEncoder, cfg.AudioEncoder)+extension)
if _, err := os.Stat(newFileFullPath); err == nil { if _, err := os.Stat(newFileFullPath); err == nil {
if cfg.SkipEncodedVid { if cfg.IgnoreConflictingName {
log.Printf("Skipping \"%s\" because it already exists with the exact same encodings (crf and preset might be different though)", newFileFullPath) log.Printf("Skipping \"%s\" because it already exists with the exact same encodings (crf and preset might be different though)", newFileFullPath)
teaP.Send(finishedEncodingVideo{}) teaP.Send(finishedEncodingVideo{})
return return