Fix minor bottom margin TS convert bug + improve TS UI settings

This commit is contained in:
Nikolaj Olsson 2019-10-11 17:43:51 +02:00
parent a175492246
commit 9b8262f783
12 changed files with 229 additions and 75 deletions

View File

@ -217,6 +217,8 @@ Note: Do check free disk space.</WaveFileMalformed>
<TransportStreamOverrideXPosition>Override original X position</TransportStreamOverrideXPosition>
<TransportStreamOverrideYPosition>Override original Y position</TransportStreamOverrideYPosition>
<TransportStreamOverrideVideoSize>Override original video size</TransportStreamOverrideVideoSize>
<TransportStreamFileNameEnding>File name ending</TransportStreamFileNameEnding>
<TransportStreamSettingsButton>TS settings...</TransportStreamSettingsButton>
</BatchConvert>
<Beamer>
<Title>Beamer</Title>

View File

@ -356,7 +356,9 @@ namespace Nikse.SubtitleEdit.Core
TransportStreamSettings = "Transport Stream settings",
TransportStreamOverrideXPosition = "Override original X position",
TransportStreamOverrideYPosition = "Override original Y position",
TransportStreamOverrideVideoSize = "Override original video size"
TransportStreamOverrideVideoSize = "Override original video size",
TransportStreamFileNameEnding = "File name ending",
TransportStreamSettingsButton = "TS settings..."
};
Beamer = new LanguageStructure.Beamer

View File

@ -592,6 +592,12 @@ namespace Nikse.SubtitleEdit.Core
case "BatchConvert/TransportStreamOverrideVideoSize":
language.BatchConvert.TransportStreamOverrideVideoSize = reader.Value;
break;
case "BatchConvert/TransportStreamFileNameEnding":
language.BatchConvert.TransportStreamFileNameEnding = reader.Value;
break;
case "BatchConvert/TransportStreamSettingsButton":
language.BatchConvert.TransportStreamSettingsButton = reader.Value;
break;
case "Beamer/Title":
language.Beamer.Title = reader.Value;
break;

View File

@ -227,6 +227,8 @@
public string TransportStreamOverrideXPosition { get; set; }
public string TransportStreamOverrideYPosition { get; set; }
public string TransportStreamOverrideVideoSize { get; set; }
public string TransportStreamFileNameEnding { get; set; }
public string TransportStreamSettingsButton { get; set; }
}
public class Beamer

View File

@ -159,6 +159,7 @@ namespace Nikse.SubtitleEdit.Core
public bool BatchConvertTsOverrideScreenSize { get; set; }
public int BatchConvertTsScreenWidth { get; set; }
public int BatchConvertTsScreenHeight { get; set; }
public string BatchConvertTsFileNameAppend { get; set; }
public string ModifySelectionText { get; set; }
public string ModifySelectionRule { get; set; }
public bool ModifySelectionCaseSensitive { get; set; }
@ -293,6 +294,7 @@ namespace Nikse.SubtitleEdit.Core
BatchConvertTsScreenHeight = 1080;
BatchConvertTsOverrideHAlign = "center"; // left center right
BatchConvertTsOverrideHMargin = 5; // pct
BatchConvertTsFileNameAppend = ".{two-letter-country-code}";
ModifySelectionRule = "Contains";
ModifySelectionText = string.Empty;
GenerateTimeCodePatterns = "HH:mm:ss;yyyy-MM-dd;dddd dd MMMM yyyy <br>HH:mm:ss;dddd dd MMMM yyyy <br>hh:mm:ss tt;s";
@ -2966,6 +2968,12 @@ $HorzAlign = Center
settings.Tools.BatchConvertTsScreenHeight = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("BatchConvertTsFileNameAppend");
if (subNode != null)
{
settings.Tools.BatchConvertTsFileNameAppend = subNode.InnerText;
}
subNode = node.SelectSingleNode("ModifySelectionRule");
if (subNode != null)
{
@ -6127,6 +6135,7 @@ $HorzAlign = Center
textWriter.WriteElementString("BatchConvertTsOverrideScreenSize", settings.Tools.BatchConvertTsOverrideScreenSize.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BatchConvertTsScreenWidth", settings.Tools.BatchConvertTsScreenWidth.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BatchConvertTsScreenHeight", settings.Tools.BatchConvertTsScreenHeight.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("BatchConvertTsFileNameAppend", settings.Tools.BatchConvertTsFileNameAppend);
textWriter.WriteElementString("ModifySelectionRule", settings.Tools.ModifySelectionRule);
textWriter.WriteElementString("ModifySelectionText", settings.Tools.ModifySelectionText);
textWriter.WriteElementString("ModifySelectionCaseSensitive", settings.Tools.ModifySelectionCaseSensitive.ToString());

View File

@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Nikse.SubtitleEdit.Core.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.TimeCode();
Nikse.SubtitleEdit.Core.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.TimeCode();
this.buttonConvert = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxConvertOptions = new System.Windows.Forms.GroupBox();
@ -59,12 +59,12 @@
this.groupBoxOffsetTimeCodes = new System.Windows.Forms.GroupBox();
this.radioButtonShowLater = new System.Windows.Forms.RadioButton();
this.radioButtonShowEarlier = new System.Windows.Forms.RadioButton();
this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown();
this.labelHourMinSecMilliSecond = new System.Windows.Forms.Label();
this.checkBoxFixCasing = new System.Windows.Forms.CheckBox();
this.checkBoxRemoveTextForHI = new System.Windows.Forms.CheckBox();
this.checkBoxRemoveFormatting = new System.Windows.Forms.CheckBox();
this.groupBoxOutput = new System.Windows.Forms.GroupBox();
this.buttonTransportStreamSettings = new System.Windows.Forms.Button();
this.checkBoxUseStyleFromSource = new System.Windows.Forms.CheckBox();
this.checkBoxOverwriteOriginalFiles = new System.Windows.Forms.CheckBox();
this.linkLabelOpenOutputFolder = new System.Windows.Forms.LinkLabel();
@ -93,12 +93,11 @@
this.contextMenuStripFiles = new System.Windows.Forms.ContextMenuStrip(this.components);
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparatorTs = new System.Windows.Forms.ToolStripSeparator();
this.transportStreamSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.labelStatus = new System.Windows.Forms.Label();
this.timeUpDownAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown();
this.groupBoxConvertOptions.SuspendLayout();
this.groupBoxSpeed.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPercent)).BeginInit();
@ -214,7 +213,7 @@
this.groupBoxSpeed.Location = new System.Drawing.Point(444, 89);
this.groupBoxSpeed.Name = "groupBoxSpeed";
this.groupBoxSpeed.Size = new System.Drawing.Size(132, 115);
this.groupBoxSpeed.TabIndex = 12;
this.groupBoxSpeed.TabIndex = 300;
this.groupBoxSpeed.TabStop = false;
this.groupBoxSpeed.Text = "Change speed";
//
@ -378,7 +377,7 @@
this.groupBoxChangeFrameRate.Location = new System.Drawing.Point(295, 12);
this.groupBoxChangeFrameRate.Name = "groupBoxChangeFrameRate";
this.groupBoxChangeFrameRate.Size = new System.Drawing.Size(281, 73);
this.groupBoxChangeFrameRate.TabIndex = 10;
this.groupBoxChangeFrameRate.TabIndex = 100;
this.groupBoxChangeFrameRate.TabStop = false;
this.groupBoxChangeFrameRate.Text = "Change frame rate";
//
@ -425,7 +424,7 @@
this.groupBoxOffsetTimeCodes.Location = new System.Drawing.Point(295, 89);
this.groupBoxOffsetTimeCodes.Name = "groupBoxOffsetTimeCodes";
this.groupBoxOffsetTimeCodes.Size = new System.Drawing.Size(143, 119);
this.groupBoxOffsetTimeCodes.TabIndex = 11;
this.groupBoxOffsetTimeCodes.TabIndex = 200;
this.groupBoxOffsetTimeCodes.TabStop = false;
this.groupBoxOffsetTimeCodes.Text = "Offset time codes";
//
@ -451,26 +450,6 @@
this.radioButtonShowEarlier.Text = "Show earlier";
this.radioButtonShowEarlier.UseVisualStyleBackColor = true;
//
// timeUpDownAdjust
//
this.timeUpDownAdjust.AutoSize = true;
this.timeUpDownAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.timeUpDownAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
this.timeUpDownAdjust.Location = new System.Drawing.Point(7, 37);
this.timeUpDownAdjust.Margin = new System.Windows.Forms.Padding(4);
this.timeUpDownAdjust.Name = "timeUpDownAdjust";
this.timeUpDownAdjust.Size = new System.Drawing.Size(96, 27);
this.timeUpDownAdjust.TabIndex = 1;
timeCode2.Hours = 0;
timeCode2.Milliseconds = 0;
timeCode2.Minutes = 0;
timeCode2.Seconds = 0;
timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode2.TotalMilliseconds = 0D;
timeCode2.TotalSeconds = 0D;
this.timeUpDownAdjust.TimeCode = timeCode2;
this.timeUpDownAdjust.UseVideoOffset = false;
//
// labelHourMinSecMilliSecond
//
this.labelHourMinSecMilliSecond.AutoSize = true;
@ -514,6 +493,7 @@
//
this.groupBoxOutput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxOutput.Controls.Add(this.buttonTransportStreamSettings);
this.groupBoxOutput.Controls.Add(this.checkBoxUseStyleFromSource);
this.groupBoxOutput.Controls.Add(this.checkBoxOverwriteOriginalFiles);
this.groupBoxOutput.Controls.Add(this.linkLabelOpenOutputFolder);
@ -534,6 +514,17 @@
this.groupBoxOutput.TabStop = false;
this.groupBoxOutput.Text = "Output";
//
// buttonTransportStreamSettings
//
this.buttonTransportStreamSettings.Location = new System.Drawing.Point(300, 170);
this.buttonTransportStreamSettings.Name = "buttonTransportStreamSettings";
this.buttonTransportStreamSettings.Size = new System.Drawing.Size(116, 23);
this.buttonTransportStreamSettings.TabIndex = 10;
this.buttonTransportStreamSettings.Text = "TS settings...";
this.buttonTransportStreamSettings.UseVisualStyleBackColor = true;
this.buttonTransportStreamSettings.Visible = false;
this.buttonTransportStreamSettings.Click += new System.EventHandler(this.buttonTransportStreamSettings_Click);
//
// checkBoxUseStyleFromSource
//
this.checkBoxUseStyleFromSource.AutoSize = true;
@ -614,7 +605,7 @@
this.comboBoxEncoding.Location = new System.Drawing.Point(80, 198);
this.comboBoxEncoding.Name = "comboBoxEncoding";
this.comboBoxEncoding.Size = new System.Drawing.Size(214, 21);
this.comboBoxEncoding.TabIndex = 10;
this.comboBoxEncoding.TabIndex = 11;
//
// labelOutputFormat
//
@ -797,39 +788,25 @@
//
this.contextMenuStripFiles.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.removeToolStripMenuItem,
this.removeAllToolStripMenuItem,
this.toolStripSeparatorTs,
this.transportStreamSettingsToolStripMenuItem});
this.removeAllToolStripMenuItem});
this.contextMenuStripFiles.Name = "contextMenuStripStyles";
this.contextMenuStripFiles.Size = new System.Drawing.Size(217, 98);
this.contextMenuStripFiles.Size = new System.Drawing.Size(133, 48);
this.contextMenuStripFiles.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripFilesOpening);
//
// removeToolStripMenuItem
//
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
this.removeToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.removeToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.removeToolStripMenuItem.Text = "Remove";
this.removeToolStripMenuItem.Click += new System.EventHandler(this.RemoveToolStripMenuItemClick);
//
// removeAllToolStripMenuItem
//
this.removeAllToolStripMenuItem.Name = "removeAllToolStripMenuItem";
this.removeAllToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.removeAllToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.removeAllToolStripMenuItem.Text = "Remove all";
this.removeAllToolStripMenuItem.Click += new System.EventHandler(this.RemoveAllToolStripMenuItemClick);
//
// toolStripSeparatorTs
//
this.toolStripSeparatorTs.Name = "toolStripSeparatorTs";
this.toolStripSeparatorTs.Size = new System.Drawing.Size(213, 6);
//
// transportStreamSettingsToolStripMenuItem
//
this.transportStreamSettingsToolStripMenuItem.Name = "transportStreamSettingsToolStripMenuItem";
this.transportStreamSettingsToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.transportStreamSettingsToolStripMenuItem.Text = "Transport Stream settings...";
this.transportStreamSettingsToolStripMenuItem.Click += new System.EventHandler(this.TransportStreamSettingsToolStripMenuItem_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
@ -853,6 +830,26 @@
this.labelStatus.TabIndex = 9;
this.labelStatus.Text = "labelStatus";
//
// timeUpDownAdjust
//
this.timeUpDownAdjust.AutoSize = true;
this.timeUpDownAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.timeUpDownAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);
this.timeUpDownAdjust.Location = new System.Drawing.Point(7, 37);
this.timeUpDownAdjust.Margin = new System.Windows.Forms.Padding(4);
this.timeUpDownAdjust.Name = "timeUpDownAdjust";
this.timeUpDownAdjust.Size = new System.Drawing.Size(96, 27);
this.timeUpDownAdjust.TabIndex = 1;
timeCode1.Hours = 0;
timeCode1.Milliseconds = 0;
timeCode1.Minutes = 0;
timeCode1.Seconds = 0;
timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00");
timeCode1.TotalMilliseconds = 0D;
timeCode1.TotalSeconds = 0D;
this.timeUpDownAdjust.TimeCode = timeCode1;
this.timeUpDownAdjust.UseVideoOffset = false;
//
// BatchConvert
//
this.AllowDrop = true;
@ -960,7 +957,6 @@
private System.Windows.Forms.Button buttonBridgeGapsSettings;
private System.Windows.Forms.Button buttonFixRtlSettings;
private System.Windows.Forms.CheckBox checkBoxFixRtl;
private System.Windows.Forms.ToolStripSeparator toolStripSeparatorTs;
private System.Windows.Forms.ToolStripMenuItem transportStreamSettingsToolStripMenuItem;
private System.Windows.Forms.Button buttonTransportStreamSettings;
}
}

View File

@ -120,7 +120,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonCancel.Text = Configuration.Settings.Language.General.Ok;
checkBoxScanFolderRecursive.Text = l.Recursive;
checkBoxScanFolderRecursive.Left = buttonSearchFolder.Left - checkBoxScanFolderRecursive.Width - 5;
buttonTransportStreamSettings.Text = l.TransportStreamSettingsButton;
groupBoxChangeFrameRate.Text = Configuration.Settings.Language.ChangeFrameRate.Title;
groupBoxOffsetTimeCodes.Text = l.OffsetTimeCodes;
groupBoxSpeed.Text = Configuration.Settings.Language.ChangeSpeedInPercent.TitleShort;
@ -150,6 +150,7 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxSubtitleFormats.Left = comboBoxEncoding.Left;
}
buttonStyles.Left = comboBoxSubtitleFormats.Left + comboBoxSubtitleFormats.Width + 5;
buttonTransportStreamSettings.Left = buttonStyles.Left;
timeUpDownAdjust.MaskedTextBox.Text = "000000000";
@ -251,8 +252,7 @@ namespace Nikse.SubtitleEdit.Forms
_bridgeGaps = new DurationsBridgeGaps(null);
_bridgeGaps.InitializeSettingsOnly();
toolStripSeparatorTs.Visible = false;
transportStreamSettingsToolStripMenuItem.Visible = false;
buttonTransportStreamSettings.Visible = false;
}
private void buttonChooseFolder_Click(object sender, EventArgs e)
@ -479,8 +479,7 @@ namespace Nikse.SubtitleEdit.Forms
if (isTs)
{
toolStripSeparatorTs.Visible = true;
transportStreamSettingsToolStripMenuItem.Visible = true;
buttonTransportStreamSettings.Visible = true;
}
}
catch
@ -1908,7 +1907,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void TransportStreamSettingsToolStripMenuItem_Click(object sender, EventArgs e)
private void buttonTransportStreamSettings_Click(object sender, EventArgs e)
{
using (var form = new BatchConvertTsSettings())
{

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.labelBottomMargin = new System.Windows.Forms.Label();
@ -47,17 +48,26 @@
this.labelBottomMarginPercent = new System.Windows.Forms.Label();
this.buttonChooseResolution = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.labelFileNameEnding = new System.Windows.Forms.Label();
this.textBoxFielNameAppend = new System.Windows.Forms.TextBox();
this.contextMenuStripFileNameAppend = new System.Windows.Forms.ContextMenuStrip(this.components);
this.twolettercountrycodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.threelettercontrycodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.twolettercountrycodeuppercaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.labelFileEndingSample = new System.Windows.Forms.Label();
this.threelettercountrycodeuppercaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownBottomMargin)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownXMargin)).BeginInit();
this.contextMenuStripFileNameAppend.SuspendLayout();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(307, 176);
this.buttonOK.Location = new System.Drawing.Point(403, 278);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 21);
this.buttonOK.TabIndex = 90;
@ -70,7 +80,7 @@
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(388, 176);
this.buttonCancel.Location = new System.Drawing.Point(484, 278);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
this.buttonCancel.TabIndex = 100;
@ -111,7 +121,7 @@
//
// numericUpDownWidth
//
this.numericUpDownWidth.Location = new System.Drawing.Point(333, 50);
this.numericUpDownWidth.Location = new System.Drawing.Point(65, 218);
this.numericUpDownWidth.Maximum = new decimal(new int[] {
50000,
0,
@ -134,7 +144,7 @@
// labelWidth
//
this.labelWidth.AutoSize = true;
this.labelWidth.Location = new System.Drawing.Point(283, 52);
this.labelWidth.Location = new System.Drawing.Point(15, 220);
this.labelWidth.Name = "labelWidth";
this.labelWidth.Size = new System.Drawing.Size(35, 13);
this.labelWidth.TabIndex = 14;
@ -143,7 +153,7 @@
// checkBoxOverrideVideoSize
//
this.checkBoxOverrideVideoSize.AutoSize = true;
this.checkBoxOverrideVideoSize.Location = new System.Drawing.Point(286, 24);
this.checkBoxOverrideVideoSize.Location = new System.Drawing.Point(18, 192);
this.checkBoxOverrideVideoSize.Name = "checkBoxOverrideVideoSize";
this.checkBoxOverrideVideoSize.Size = new System.Drawing.Size(149, 17);
this.checkBoxOverrideVideoSize.TabIndex = 60;
@ -153,7 +163,7 @@
//
// numericUpDownHeight
//
this.numericUpDownHeight.Location = new System.Drawing.Point(333, 76);
this.numericUpDownHeight.Location = new System.Drawing.Point(65, 244);
this.numericUpDownHeight.Maximum = new decimal(new int[] {
50000,
0,
@ -176,7 +186,7 @@
// labelHeight
//
this.labelHeight.AutoSize = true;
this.labelHeight.Location = new System.Drawing.Point(283, 78);
this.labelHeight.Location = new System.Drawing.Point(15, 246);
this.labelHeight.Name = "labelHeight";
this.labelHeight.Size = new System.Drawing.Size(38, 13);
this.labelHeight.TabIndex = 17;
@ -257,7 +267,7 @@
//
// buttonChooseResolution
//
this.buttonChooseResolution.Location = new System.Drawing.Point(332, 102);
this.buttonChooseResolution.Location = new System.Drawing.Point(64, 270);
this.buttonChooseResolution.Name = "buttonChooseResolution";
this.buttonChooseResolution.Size = new System.Drawing.Size(27, 23);
this.buttonChooseResolution.TabIndex = 82;
@ -269,11 +279,81 @@
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// labelFileNameEnding
//
this.labelFileNameEnding.AutoSize = true;
this.labelFileNameEnding.Location = new System.Drawing.Point(267, 24);
this.labelFileNameEnding.Name = "labelFileNameEnding";
this.labelFileNameEnding.Size = new System.Drawing.Size(174, 13);
this.labelFileNameEnding.TabIndex = 103;
this.labelFileNameEnding.Text = "File name ending (before extension)";
//
// textBoxFielNameAppend
//
this.textBoxFielNameAppend.ContextMenuStrip = this.contextMenuStripFileNameAppend;
this.textBoxFielNameAppend.Location = new System.Drawing.Point(270, 40);
this.textBoxFielNameAppend.Name = "textBoxFielNameAppend";
this.textBoxFielNameAppend.Size = new System.Drawing.Size(289, 20);
this.textBoxFielNameAppend.TabIndex = 84;
this.textBoxFielNameAppend.Text = ".{two-letter-country-code}";
this.textBoxFielNameAppend.TextChanged += new System.EventHandler(this.TextBoxFileNameAppendTextChanged);
//
// contextMenuStripFileNameAppend
//
this.contextMenuStripFileNameAppend.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.twolettercountrycodeToolStripMenuItem,
this.threelettercontrycodeToolStripMenuItem,
this.twolettercountrycodeuppercaseToolStripMenuItem,
this.threelettercountrycodeuppercaseToolStripMenuItem});
this.contextMenuStripFileNameAppend.Name = "contextMenuStripFileNameAppend";
this.contextMenuStripFileNameAppend.Size = new System.Drawing.Size(278, 114);
//
// twolettercountrycodeToolStripMenuItem
//
this.twolettercountrycodeToolStripMenuItem.Name = "twolettercountrycodeToolStripMenuItem";
this.twolettercountrycodeToolStripMenuItem.Size = new System.Drawing.Size(277, 22);
this.twolettercountrycodeToolStripMenuItem.Text = "{two-letter-country-code}";
this.twolettercountrycodeToolStripMenuItem.Click += new System.EventHandler(this.TwoLetterCountryCodeToolStripMenuItemClick);
//
// threelettercontrycodeToolStripMenuItem
//
this.threelettercontrycodeToolStripMenuItem.Name = "threelettercontrycodeToolStripMenuItem";
this.threelettercontrycodeToolStripMenuItem.Size = new System.Drawing.Size(277, 22);
this.threelettercontrycodeToolStripMenuItem.Text = "{three-letter-contry-code}";
this.threelettercontrycodeToolStripMenuItem.Click += new System.EventHandler(this.ThreeLetterCountryCodeToolStripMenuItemClick);
//
// twolettercountrycodeuppercaseToolStripMenuItem
//
this.twolettercountrycodeuppercaseToolStripMenuItem.Name = "twolettercountrycodeuppercaseToolStripMenuItem";
this.twolettercountrycodeuppercaseToolStripMenuItem.Size = new System.Drawing.Size(277, 22);
this.twolettercountrycodeuppercaseToolStripMenuItem.Text = "{two-letter-country-code-uppercase}";
this.twolettercountrycodeuppercaseToolStripMenuItem.Click += new System.EventHandler(this.TwoLetterCountryCodeUppercaseToolStripMenuItemClick);
//
// labelFileEndingSample
//
this.labelFileEndingSample.AutoSize = true;
this.labelFileEndingSample.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.labelFileEndingSample.Location = new System.Drawing.Point(267, 63);
this.labelFileEndingSample.Name = "labelFileEndingSample";
this.labelFileEndingSample.Size = new System.Drawing.Size(174, 13);
this.labelFileEndingSample.TabIndex = 104;
this.labelFileEndingSample.Text = "File name ending (before extension)";
//
// threelettercountrycodeuppercaseToolStripMenuItem
//
this.threelettercountrycodeuppercaseToolStripMenuItem.Name = "threelettercountrycodeuppercaseToolStripMenuItem";
this.threelettercountrycodeuppercaseToolStripMenuItem.Size = new System.Drawing.Size(277, 22);
this.threelettercountrycodeuppercaseToolStripMenuItem.Text = "{three-letter-country-code-uppercase}";
this.threelettercountrycodeuppercaseToolStripMenuItem.Click += new System.EventHandler(this.ThreeLetterCountryCodeUppercaseToolStripMenuItemClick);
//
// BatchConvertTsSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(475, 209);
this.ClientSize = new System.Drawing.Size(571, 311);
this.Controls.Add(this.labelFileEndingSample);
this.Controls.Add(this.textBoxFielNameAppend);
this.Controls.Add(this.labelFileNameEnding);
this.Controls.Add(this.buttonChooseResolution);
this.Controls.Add(this.labelBottomMarginPercent);
this.Controls.Add(this.labelXMarginPercent);
@ -306,6 +386,7 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownXMargin)).EndInit();
this.contextMenuStripFileNameAppend.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -332,5 +413,13 @@
private System.Windows.Forms.Label labelBottomMarginPercent;
private System.Windows.Forms.Button buttonChooseResolution;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Label labelFileNameEnding;
private System.Windows.Forms.TextBox textBoxFielNameAppend;
private System.Windows.Forms.ContextMenuStrip contextMenuStripFileNameAppend;
private System.Windows.Forms.ToolStripMenuItem twolettercountrycodeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem threelettercontrycodeToolStripMenuItem;
private System.Windows.Forms.Label labelFileEndingSample;
private System.Windows.Forms.ToolStripMenuItem twolettercountrycodeuppercaseToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem threelettercountrycodeuppercaseToolStripMenuItem;
}
}

View File

@ -21,6 +21,7 @@ namespace Nikse.SubtitleEdit.Forms
labelXAlignment.Text = Configuration.Settings.Language.ExportPngXml.Align;
labelWidth.Text = Configuration.Settings.Language.General.Width;
labelHeight.Text = Configuration.Settings.Language.General.Height;
labelFileNameEnding.Text = Configuration.Settings.Language.BatchConvert.TransportStreamFileNameEnding;
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
UiUtil.FixLargeFonts(this, buttonOK);
@ -46,6 +47,7 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxOverrideVideoSize.Checked = Configuration.Settings.Tools.BatchConvertTsOverrideScreenSize;
numericUpDownWidth.Value = Configuration.Settings.Tools.BatchConvertTsScreenWidth;
numericUpDownHeight.Value = Configuration.Settings.Tools.BatchConvertTsScreenHeight;
textBoxFielNameAppend.Text = Configuration.Settings.Tools.BatchConvertTsFileNameAppend;
if (Configuration.Settings.Tools.BatchConvertTsOverrideHAlign.Equals("left", StringComparison.OrdinalIgnoreCase))
{
comboBoxHAlign.SelectedIndex = 0;
@ -61,6 +63,7 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxOverrideOriginalXPosition_CheckedChanged(null, null);
CheckBoxOverrideOriginalYPosition_CheckedChanged(null, null);
CheckBoxOverrideVideoSize_CheckedChanged(null, null);
TextBoxFileNameAppendTextChanged(null, null);
}
private void CheckBoxOverrideOriginalYPosition_CheckedChanged(object sender, EventArgs e)
@ -95,6 +98,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Tools.BatchConvertTsScreenWidth = (int)numericUpDownWidth.Value;
Configuration.Settings.Tools.BatchConvertTsScreenHeight = (int)numericUpDownHeight.Value;
Configuration.Settings.Tools.BatchConvertTsOverrideHMargin = (int)numericUpDownXMargin.Value;
Configuration.Settings.Tools.BatchConvertTsFileNameAppend = textBoxFielNameAppend.Text;
if (comboBoxHAlign.SelectedIndex == 0)
{
Configuration.Settings.Tools.BatchConvertTsOverrideHAlign = "left";
@ -134,5 +138,34 @@ namespace Nikse.SubtitleEdit.Forms
}
}
}
private void TwoLetterCountryCodeToolStripMenuItemClick(object sender, EventArgs e)
{
textBoxFielNameAppend.Text = textBoxFielNameAppend.Text.Insert(textBoxFielNameAppend.SelectionStart, "{two-letter-country-code}");
}
private void ThreeLetterCountryCodeToolStripMenuItemClick(object sender, EventArgs e)
{
textBoxFielNameAppend.Text = textBoxFielNameAppend.Text.Insert(textBoxFielNameAppend.SelectionStart, "{three-letter-country-code}");
}
private void TwoLetterCountryCodeUppercaseToolStripMenuItemClick(object sender, EventArgs e)
{
textBoxFielNameAppend.Text = textBoxFielNameAppend.Text.Insert(textBoxFielNameAppend.SelectionStart, "{two-letter-country-code-uppercase}");
}
private void ThreeLetterCountryCodeUppercaseToolStripMenuItemClick(object sender, EventArgs e)
{
textBoxFielNameAppend.Text = textBoxFielNameAppend.Text.Insert(textBoxFielNameAppend.SelectionStart, "{three-letter-country-code-uppercase}");
}
private void TextBoxFileNameAppendTextChanged(object sender, EventArgs e)
{
labelFileEndingSample.Text = ("MyVideoFile" + textBoxFielNameAppend.Text + ".sup")
.Replace("{two-letter-country-code}", "en")
.Replace("{two-letter-country-code-uppercase}", "EN")
.Replace("{three-letter-country-code}", "eng")
.Replace("{three-letter-country-code-uppercase}", "ENG");
}
}
}

View File

@ -120,4 +120,7 @@
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStripFileNameAppend.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>157, 17</value>
</metadata>
</root>

View File

@ -40,11 +40,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
}
foreach (int pid in tsParser.SubtitlePacketIds)
{
var language = programMapTableParser.GetSubtitleLanguageTwoLetter(pid);
if (string.IsNullOrEmpty(language))
{
language = pid.ToString(CultureInfo.InvariantCulture);
}
var language = TsToBluRaySup.GetFileNameEnding(programMapTableParser, pid);
var nameNoExt = Utilities.GetFileNameWithoutExtension(fileName) + "." + language;
var folder = Path.Combine(outputFolder, nameNoExt);
if (!Directory.Exists(folder))

View File

@ -41,12 +41,8 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
form.Initialize(new Subtitle(), new SubRip(), BatchConvert.BluRaySubtitle, fileName, null, fileName);
foreach (int pid in tsParser.SubtitlePacketIds)
{
var language = programMapTableParser.GetSubtitleLanguageTwoLetter(pid);
if (string.IsNullOrEmpty(language))
{
language = pid.ToString(CultureInfo.InvariantCulture);
}
var outputFileName = CommandLineConverter.FormatOutputFileNameForBatchConvert(Utilities.GetPathAndFileNameWithoutExtension(fileName) + "." + language + Path.GetExtension(fileName), ".sup", outputFolder, overwrite);
var language = GetFileNameEnding(programMapTableParser, pid);
var outputFileName = CommandLineConverter.FormatOutputFileNameForBatchConvert(Utilities.GetPathAndFileNameWithoutExtension(fileName) + language + Path.GetExtension(fileName), ".sup", outputFolder, overwrite);
stdOutWriter?.WriteLine($"Saving PID {pid} to {outputFileName}...");
var sub = tsParser.GetDvbSubtitles(pid);
progressCallback?.Invoke($"Save PID {pid}");
@ -138,6 +134,27 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
return true;
}
public static string GetFileNameEnding(ProgramMapTableParser pmt, int pid)
{
var twoLetter = pmt.GetSubtitleLanguageTwoLetter(pid);
var threeLetter = pmt.GetSubtitleLanguage(pid);
if (string.IsNullOrEmpty(twoLetter))
{
twoLetter = threeLetter;
}
if (string.IsNullOrEmpty(threeLetter))
{
twoLetter = pid.ToString(CultureInfo.InvariantCulture);
threeLetter = pid.ToString(CultureInfo.InvariantCulture);
}
return Configuration.Settings.Tools.BatchConvertTsFileNameAppend
.Replace("{two-letter-country-code}", twoLetter)
.Replace("{two-letter-country-code-uppercase}", twoLetter.ToUpperInvariant())
.Replace("{three-letter-country-code}", threeLetter)
.Replace("{three-letter-country-code-uppercase}", threeLetter);
}
public static Point GetSubtitleScreenSize(List<TransportStreamSubtitle> sub, bool overrideScreenSize)
{
if (overrideScreenSize)