mirror of
https://github.com/IllusionMan1212/ffui.git
synced 2026-10-24 02:12:35 +00:00
clearer(?) config name for when output file name conflicts with another
This commit is contained in:
@@ -310,12 +310,12 @@ func parseConfig(cfg []Config) ParsedConfig {
|
|||||||
crf := find(cfg, "Constant Rate Factor (CRF)")
|
crf := find(cfg, "Constant Rate Factor (CRF)")
|
||||||
|
|
||||||
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],
|
||||||
CRF: crf.Opts[crf.FocusedOption],
|
CRF: crf.Opts[crf.FocusedOption],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,12 +98,12 @@ 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],
|
||||||
CRF: crf.Opts[crf.FocusedOption],
|
CRF: crf.Opts[crf.FocusedOption],
|
||||||
},
|
},
|
||||||
dryRun: dryRun,
|
dryRun: dryRun,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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},
|
||||||
@@ -32,12 +32,12 @@ 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
|
||||||
CRF string
|
CRF string
|
||||||
}
|
}
|
||||||
|
|
||||||
func find(cfgs []Config, name string) Config {
|
func find(cfgs []Config, name string) Config {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user