diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/Constants.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs | 17 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.Designer.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/Resources.resx | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 6 |
5 files changed, 21 insertions, 11 deletions
diff --git a/win/CS/HandBrakeWPF/Constants.cs b/win/CS/HandBrakeWPF/Constants.cs index 1c985ecdb..c47bc8dc1 100644 --- a/win/CS/HandBrakeWPF/Constants.cs +++ b/win/CS/HandBrakeWPF/Constants.cs @@ -70,6 +70,11 @@ namespace HandBrakeWPF public const string Bitrate = "{bitrate}";
/// <summary>
+ /// The preset.
+ /// </summary>
+ public const string Preset = "{preset}";
+
+ /// <summary>
/// Preset Major Version
/// </summary>
public const string PresetVersionMajor = "11";
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index a0fdbb0dc..ec158e751 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -19,6 +19,7 @@ namespace HandBrakeWPF.Helpers using HandBrakeWPF.Extensions;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Presets.Model;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
using OutputFormat = HandBrakeWPF.Services.Encode.Model.Models.OutputFormat;
@@ -41,7 +42,7 @@ namespace HandBrakeWPF.Helpers /// <returns>
/// The Generated FileName
/// </returns>
- public static string AutoName(EncodeTask task, string sourceOrLabelName)
+ public static string AutoName(EncodeTask task, string sourceOrLabelName, Preset presetName)
{
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
if (task.Destination == null)
@@ -54,6 +55,7 @@ namespace HandBrakeWPF.Helpers {
// Get the Source Name and remove any invalid characters
string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
+ string sanitisedPresetName = presetName != null ? Path.GetInvalidFileNameChars().Aggregate(presetName.Name, (current, character) => current.Replace(character.ToString(), string.Empty)) : string.Empty;
// Remove Underscores
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
@@ -88,11 +90,14 @@ namespace HandBrakeWPF.Helpers if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != string.Empty)
{
destinationFilename = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
- destinationFilename = destinationFilename.Replace("{source}", sourceName)
- .Replace(Constants.Title, dvdTitle)
- .Replace(Constants.Chapters, combinedChapterTag)
- .Replace(Constants.Date, DateTime.Now.Date.ToShortDateString().Replace('/', '-'))
- .Replace(Constants.Time, DateTime.Now.ToString("HH:mm"));
+ destinationFilename =
+ destinationFilename
+ .Replace("{source}", sourceName)
+ .Replace(Constants.Title, dvdTitle)
+ .Replace(Constants.Chapters, combinedChapterTag)
+ .Replace(Constants.Date, DateTime.Now.Date.ToShortDateString().Replace('/', '-'))
+ .Replace(Constants.Time,DateTime.Now.ToString("HH:mm"))
+ .Replace(Constants.Preset, sanitisedPresetName);
if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)
{
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 297a5caf1..ce0ed2cbd 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -1119,7 +1119,7 @@ namespace HandBrakeWPF.Properties { /// Looks up a localized string similar to The format of the output file. In addition to any supported file system character, you can use the following placeholders that will be replaced when you change title or scan a source.
///
///Live Update Options: {source} {title} {chapters}
- ///Non-Live Options: {date} {time} {quality} {bitrate} (These only change if you scan a new source, change title or chapters).
+ ///Non-Live Options: {date} {time} {quality} {bitrate} {preset} (These only change if you scan a new source, change title or chapters).
/// </summary>
public static string Options_AdditionalFormatOptions {
get {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 17767838a..446e9f3a6 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -480,7 +480,7 @@ Do you wish to proceed?</value> <value>The format of the output file. In addition to any supported file system character, you can use the following placeholders that will be replaced when you change title or scan a source.
Live Update Options: {source} {title} {chapters}
-Non-Live Options: {date} {time} {quality} {bitrate} (These only change if you scan a new source, change title or chapters)</value>
+Non-Live Options: {date} {time} {quality} {bitrate} {preset} (These only change if you scan a new source, change title or chapters)</value>
</data>
<data name="Options_DefaultPathAdditionalParams" xml:space="preserve">
<value>Available additional Options: {source_path} or {source_folder_name}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index fff4d8a70..e2d15b2ab 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -762,7 +762,7 @@ namespace HandBrakeWPF.ViewModels {
if (this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != null)
{
- this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName);
+ this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName, this.SelectedPreset);
}
}
this.NotifyOfPropertyChange(() => this.CurrentTask);
@@ -817,7 +817,7 @@ namespace HandBrakeWPF.ViewModels if (this.SelectedPointToPoint == PointToPointMode.Chapters && this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != null &&
this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat).Contains(Constants.Chapters))
{
- this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName);
+ this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName, this.SelectedPreset);
}
}
@@ -846,7 +846,7 @@ namespace HandBrakeWPF.ViewModels if (this.SelectedPointToPoint == PointToPointMode.Chapters && this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != null &&
this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat).Contains(Constants.Chapters))
{
- this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName);
+ this.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName, this.SelectedPreset);
}
if (this.SelectedStartPoint > this.SelectedEndPoint && this.SelectedPointToPoint == PointToPointMode.Chapters)
|