diff --git a/VidCoder/Model/WhenFileExists.cs b/VidCoder/Model/WhenFileExists.cs index 76f69aa5..06f25433 100644 --- a/VidCoder/Model/WhenFileExists.cs +++ b/VidCoder/Model/WhenFileExists.cs @@ -9,5 +9,6 @@ public enum WhenFileExists { Prompt, Overwrite, - AutoRename + AutoRename, + Skip } diff --git a/VidCoder/Resources/EnumsRes.Designer.cs b/VidCoder/Resources/EnumsRes.Designer.cs index 6caab3d2..111237a4 100644 --- a/VidCoder/Resources/EnumsRes.Designer.cs +++ b/VidCoder/Resources/EnumsRes.Designer.cs @@ -887,5 +887,14 @@ public static string WhenFileExists_Prompt { return ResourceManager.GetString("WhenFileExists_Prompt", resourceCulture); } } + + /// + /// Looks up a localized string similar to Skip. + /// + public static string WhenFileExists_Skip { + get { + return ResourceManager.GetString("WhenFileExists_Skip", resourceCulture); + } + } } } diff --git a/VidCoder/Resources/EnumsRes.resx b/VidCoder/Resources/EnumsRes.resx index 878924f1..b7279ef6 100644 --- a/VidCoder/Resources/EnumsRes.resx +++ b/VidCoder/Resources/EnumsRes.resx @@ -405,4 +405,7 @@ Restart + + Skip + \ No newline at end of file diff --git a/VidCoder/Services/OutputPathService.cs b/VidCoder/Services/OutputPathService.cs index f26f0c16..672c7ca1 100644 --- a/VidCoder/Services/OutputPathService.cs +++ b/VidCoder/Services/OutputPathService.cs @@ -209,6 +209,9 @@ public string ResolveOutputPathConflicts( { case WhenFileExists.Prompt: break; + case WhenFileExists.Skip: + StaticResolver.Resolve().Log("Skipping job, output file already exists: " + initialOutputPath); + return null; case WhenFileExists.Overwrite: if (checkResult == FileQueueCheckResult.InQueue && allowQueueRemoval) { diff --git a/VidCoder/Services/ProcessingService.cs b/VidCoder/Services/ProcessingService.cs index 0b7ce877..17a0e5c2 100644 --- a/VidCoder/Services/ProcessingService.cs +++ b/VidCoder/Services/ProcessingService.cs @@ -1528,23 +1528,30 @@ public void QueueTitles(List titles, int titleStartOverride, string string extension = this.outputPathService.GetOutputExtension(); string queueOutputPath = this.outputPathService.BuildOutputPath(queueOutputFileName, extension, sourcePath: null, outputFolder: outputFolder); + string finalOutputPath = this.outputPathService.ResolveOutputPathConflicts(queueOutputPath, this.main.SourcePath, isBatch: true, picker, allowConflictDialog: false, allowQueueRemoval: true); - job.FinalOutputPath = this.outputPathService.ResolveOutputPathConflicts(queueOutputPath, this.main.SourcePath, isBatch: true, picker, allowConflictDialog: false, allowQueueRemoval: true); + if (finalOutputPath != null) + { + job.FinalOutputPath = finalOutputPath; - var jobVM = new EncodeJobViewModel( - job, - this.main.SourceData, - this.main.GetVideoSourceMetadata(), - sourceParentFolder: null, - manualOutputPath: false, - nameFormatOverride: nameFormatOverride, - presetName: this.presetsService.SelectedPreset.DisplayName, - pickerName: picker.Name); + var jobVM = new EncodeJobViewModel( + job, + this.main.SourceData, + this.main.GetVideoSourceMetadata(), + sourceParentFolder: null, + manualOutputPath: false, + nameFormatOverride: nameFormatOverride, + presetName: this.presetsService.SelectedPreset.DisplayName, + pickerName: picker.Name); - jobsToAdd.Add(jobVM); + jobsToAdd.Add(jobVM); + } } - this.QueueMultipleJobs(jobsToAdd); + if (jobsToAdd.Count > 0) + { + this.QueueMultipleJobs(jobsToAdd); + } } private void RetryJobIfNeeded(EncodeJobViewModel encodeJobViewModel) @@ -1715,8 +1722,6 @@ public void QueueFromScanResults(IList scanResults, bool start) presetName: preset.Name, pickerName: picker.Name); - itemsToQueue.Add(jobVM); - var titles = jobVM.VideoSource.Titles; SourceTitle title = titles.Single(t => t.Index == job.Title); @@ -1755,20 +1760,25 @@ public void QueueFromScanResults(IList scanResults, bool start) allowConflictDialog: !scanResult.JobInstructions.IsBatch, allowQueueRemoval: true); - if (Utilities.IsValidFullPath(queueOutputPath)) + if (queueOutputPath != null) { - job.FinalOutputPath = queueOutputPath; + itemsToQueue.Add(jobVM); - queuedOutputFiles.Add(queueOutputPath); - } - else - { - this.logger.LogError($"Could not add \"{queueOutputPath}\" to queue; it is not a valid full file path."); - } + if (Utilities.IsValidFullPath(queueOutputPath)) + { + job.FinalOutputPath = queueOutputPath; - if (scanResults.Count == 1 && !string.IsNullOrWhiteSpace(scanResult.JobInstructions.DestinationOverride)) - { - job.FinalOutputPath = scanResult.JobInstructions.DestinationOverride; + queuedOutputFiles.Add(queueOutputPath); + } + else + { + this.logger.LogError($"Could not add \"{queueOutputPath}\" to queue; it is not a valid full file path."); + } + + if (scanResults.Count == 1 && !string.IsNullOrWhiteSpace(scanResult.JobInstructions.DestinationOverride)) + { + job.FinalOutputPath = scanResult.JobInstructions.DestinationOverride; + } } } } diff --git a/VidCoder/ViewModel/PickerWindowViewModel.cs b/VidCoder/ViewModel/PickerWindowViewModel.cs index ba83a9ad..d2c94dac 100644 --- a/VidCoder/ViewModel/PickerWindowViewModel.cs +++ b/VidCoder/ViewModel/PickerWindowViewModel.cs @@ -634,6 +634,7 @@ public WhenFileExists WhenFileExistsSingle { new ComboChoice(WhenFileExists.Overwrite, EnumsRes.WhenFileExists_Overwrite), new ComboChoice(WhenFileExists.AutoRename, EnumsRes.WhenFileExists_AutoRename), + new ComboChoice(WhenFileExists.Skip, EnumsRes.WhenFileExists_Skip), }; public WhenFileExists WhenFileExistsBatch