diff options
author | sr55 <[email protected]> | 2011-04-22 18:07:12 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-04-22 18:07:12 +0000 |
commit | 47221be3bbe8d7dae0a714d736ae0f0b23ee08ba (patch) | |
tree | 04a0f42bf3fb8bef0e87290bf244a0eb424de23d /win | |
parent | 63a726b5e80d17083b0f8bf3e96c5749df45bc98 (diff) |
WinGui:
- Added new substitute option to the AutoName default path feature. "{source_folder_name}"
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3951 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/Functions/Main.cs | 30 | ||||
-rw-r--r-- | win/CS/frmOptions.Designer.cs | 10 | ||||
-rw-r--r-- | win/CS/frmOptions.resx | 8 |
3 files changed, 37 insertions, 11 deletions
diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs index ae13e3f18..41d004007 100644 --- a/win/CS/Functions/Main.cs +++ b/win/CS/Functions/Main.cs @@ -175,12 +175,13 @@ namespace Handbrake.Functions if (mainWindow.drp_dvdtitle.Text != "Automatic")
{
// Get the Source Name and remove any invalid characters
-
string sourceName = Path.GetInvalidFileNameChars().Aggregate(Path.GetFileNameWithoutExtension(mainWindow.SourceName), (current, character) => current.Replace(character.ToString(), string.Empty));
+ // Remove Underscores
if (Properties.Settings.Default.AutoNameRemoveUnderscore)
sourceName = sourceName.Replace("_", " ");
+ // Switch to "Title Case"
if (Properties.Settings.Default.AutoNameTitleCase)
sourceName = sourceName.ToTitleCase();
@@ -195,7 +196,9 @@ namespace Handbrake.Functions if (chapterFinish != chapterStart && chapterFinish != string.Empty)
combinedChapterTag = chapterStart + "-" + chapterFinish;
- // Get the destination filename.
+ /*
+ * File Name
+ */
string destinationFilename;
if (Properties.Settings.Default.autoNameFormat != string.Empty)
{
@@ -207,7 +210,9 @@ namespace Handbrake.Functions else
destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
- // Add the appropriate file extension
+ /*
+ * File Extension
+ */
if (mainWindow.drop_format.SelectedIndex == 0)
{
switch (Properties.Settings.Default.useM4v)
@@ -229,7 +234,10 @@ namespace Handbrake.Functions else if (mainWindow.drop_format.SelectedIndex == 1)
destinationFilename += ".mkv";
- // Now work out the path where the file will be stored.
+ /*
+ * File Destination Path
+ */
+
// If there is an auto name path, use it...
if (Properties.Settings.Default.autoNamePath.Trim() == "{source_path}" && !string.IsNullOrEmpty(mainWindow.sourcePath))
{
@@ -240,9 +248,21 @@ namespace Handbrake.Functions autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), "output_" + destinationFilename);
}
}
- // Second case: If the destination box doesn't already contain a path, make one.
+ else if (Properties.Settings.Default.autoNamePath.Contains("{source_folder_name}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
+ {
+ // Second Case: We have a Path, with "{source_folder}" in it, therefore we need to replace it with the folder name from the source.
+ string path = Path.GetDirectoryName(mainWindow.sourcePath);
+ if (!string.IsNullOrEmpty(path))
+ {
+ string[] filesArray = path.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
+ string sourceFolder = filesArray[filesArray.Length - 1];
+
+ autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath.Replace("{source_folder_name}", sourceFolder), destinationFilename);
+ }
+ }
else if (!mainWindow.text_destination.Text.Contains(Path.DirectorySeparatorChar.ToString()))
{
+ // Third case: If the destination box doesn't already contain a path, make one.
if (Properties.Settings.Default.autoNamePath.Trim() != string.Empty && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
{
autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);
diff --git a/win/CS/frmOptions.Designer.cs b/win/CS/frmOptions.Designer.cs index 47b938942..83ad47d2a 100644 --- a/win/CS/frmOptions.Designer.cs +++ b/win/CS/frmOptions.Designer.cs @@ -424,7 +424,7 @@ namespace Handbrake this.check_autoNaming.AutoSize = true;
this.check_autoNaming.Location = new System.Drawing.Point(111, 13);
this.check_autoNaming.Name = "check_autoNaming";
- this.check_autoNaming.Size = new System.Drawing.Size(171, 17);
+ this.check_autoNaming.Size = new System.Drawing.Size(176, 17);
this.check_autoNaming.TabIndex = 72;
this.check_autoNaming.Text = "Automatically name output files";
this.ToolTip.SetToolTip(this.check_autoNaming, "Automatically name output files");
@@ -513,12 +513,10 @@ namespace Handbrake this.label34.Location = new System.Drawing.Point(182, 72);
this.label34.Margin = new System.Windows.Forms.Padding(3);
this.label34.Name = "label34";
- this.label34.Size = new System.Drawing.Size(167, 13);
+ this.label34.Size = new System.Drawing.Size(278, 13);
this.label34.TabIndex = 102;
- this.label34.Text = "Available Options: {source_path}";
- this.ToolTip.SetToolTip(this.label34, "{source_path} = Use the same directory as the source is in.\r\nNote: you can not us" +
- "e {source_path} within a path. It has to be the only text in the path above to " +
- "work.");
+ this.label34.Text = "Available Options: {source_path} {source_folder_name}";
+ this.ToolTip.SetToolTip(this.label34, resources.GetString("label34.ToolTip"));
//
// check_TitleCase
//
diff --git a/win/CS/frmOptions.resx b/win/CS/frmOptions.resx index 1c6c329c6..6cfdf4403 100644 --- a/win/CS/frmOptions.resx +++ b/win/CS/frmOptions.resx @@ -132,6 +132,14 @@ Note, the file itself is identical. This simply changes the default extension fo <value>This is the default location where your encoded files will be stored if "Automatically name output files" is enabled.
You can enter {source_path} instead of a path to use the same path as the source file.</value>
</data>
+ <data name="label34.ToolTip" xml:space="preserve">
+ <value>{source_path} = Use the same directory as the source is in.
+This option has to be used on it's own and can not be used as part of a path.
+
+{source_folder_name} = Uses the folder name where the source is stored.
+You can insert this anywhere in your path. e.g. c:\movies\{source_folder_name}
+It will substitute the name of the folder where the source is located.</value>
+ </data>
<data name="check_showCliForInGUIEncode.ToolTip" xml:space="preserve">
<value>Shows the CLI window when encoding.
You may wish to enable this as you'll be able to cleanly exit the CLI using ctrl-c
|