mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
parent
d9a52bb9a5
commit
2815320130
@ -176,7 +176,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
public string ChatGptUrl { get; set; }
|
public string ChatGptUrl { get; set; }
|
||||||
public string ChatGptApiKey { get; set; }
|
public string ChatGptApiKey { get; set; }
|
||||||
public string ChatGptModel { get; set; }
|
public string ChatGptModel { get; set; }
|
||||||
public int ChatGptDelaySeconds { get; set; }
|
public int AutoTranslateDelaySeconds { get; set; }
|
||||||
public string GeminiProApiKey { get; set; }
|
public string GeminiProApiKey { get; set; }
|
||||||
public bool DisableVidoInfoViaLabel { get; set; }
|
public bool DisableVidoInfoViaLabel { get; set; }
|
||||||
public bool ListViewSyntaxColorDurationSmall { get; set; }
|
public bool ListViewSyntaxColorDurationSmall { get; set; }
|
||||||
@ -5336,10 +5336,10 @@ $HorzAlign = Center
|
|||||||
settings.Tools.ChatGptModel = subNode.InnerText;
|
settings.Tools.ChatGptModel = subNode.InnerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
subNode = node.SelectSingleNode("ChatGptDelaySeconds");
|
subNode = node.SelectSingleNode("AutoTranslateDelaySeconds");
|
||||||
if (subNode != null)
|
if (subNode != null)
|
||||||
{
|
{
|
||||||
settings.Tools.ChatGptDelaySeconds = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
|
settings.Tools.AutoTranslateDelaySeconds = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
subNode = node.SelectSingleNode("GeminiProApiKey");
|
subNode = node.SelectSingleNode("GeminiProApiKey");
|
||||||
@ -11811,7 +11811,7 @@ $HorzAlign = Center
|
|||||||
textWriter.WriteElementString("ChatGptUrl", settings.Tools.ChatGptUrl);
|
textWriter.WriteElementString("ChatGptUrl", settings.Tools.ChatGptUrl);
|
||||||
textWriter.WriteElementString("ChatGptApiKey", settings.Tools.ChatGptApiKey);
|
textWriter.WriteElementString("ChatGptApiKey", settings.Tools.ChatGptApiKey);
|
||||||
textWriter.WriteElementString("ChatGptModel", settings.Tools.ChatGptModel);
|
textWriter.WriteElementString("ChatGptModel", settings.Tools.ChatGptModel);
|
||||||
textWriter.WriteElementString("ChatGptDelaySeconds", settings.Tools.ChatGptDelaySeconds.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("AutoTranslateDelaySeconds", settings.Tools.AutoTranslateDelaySeconds.ToString(CultureInfo.InvariantCulture));
|
||||||
textWriter.WriteElementString("GeminiProApiKey", settings.Tools.GeminiProApiKey);
|
textWriter.WriteElementString("GeminiProApiKey", settings.Tools.GeminiProApiKey);
|
||||||
textWriter.WriteElementString("DisableVidoInfoViaLabel", settings.Tools.DisableVidoInfoViaLabel.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("DisableVidoInfoViaLabel", settings.Tools.DisableVidoInfoViaLabel.ToString(CultureInfo.InvariantCulture));
|
||||||
textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture));
|
textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture));
|
||||||
|
120
src/libse/SubtitleFormats/Smil30.cs
Normal file
120
src/libse/SubtitleFormats/Smil30.cs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using Nikse.SubtitleEdit.Core.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||||
|
{
|
||||||
|
public class Smil30 : SubtitleFormat
|
||||||
|
{
|
||||||
|
public override string Extension => ".xml";
|
||||||
|
|
||||||
|
public override string Name => "SMIL 3.0";
|
||||||
|
|
||||||
|
private static string ToTimeCode(TimeCode tc)
|
||||||
|
{
|
||||||
|
return tc.ToString(false).Replace(',', '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TimeCode DecodeTimeCode(string s)
|
||||||
|
{
|
||||||
|
var parts = s.Split(new[] { ';', ':', '.', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
return DecodeTimeCodeFramesFourParts(parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToText(Subtitle subtitle, string title)
|
||||||
|
{
|
||||||
|
var xml = new XmlDocument();
|
||||||
|
xml.LoadXml("<smil xmlns=\"http://www.w3.org/ns/SMIL\" xmlns:epub=\"http://www.idpf.org/2007/ops\" version=\"3.0\"><body></body></smil>");
|
||||||
|
|
||||||
|
const string ns = "http://www.w3.org/ns/SMIL";
|
||||||
|
var nsmgr = new XmlNamespaceManager(xml.NameTable);
|
||||||
|
nsmgr.AddNamespace("smil", ns);
|
||||||
|
nsmgr.AddNamespace("epub", "http://www.idpf.org/2007/ops");
|
||||||
|
|
||||||
|
XmlNode bodyNode = xml.SelectSingleNode("//smil:body", nsmgr);
|
||||||
|
var count = 1;
|
||||||
|
foreach (var p in subtitle.Paragraphs)
|
||||||
|
{
|
||||||
|
XmlNode paragraph = xml.CreateElement("par", ns);
|
||||||
|
XmlNode text = xml.CreateElement("text", ns);
|
||||||
|
XmlNode audio = xml.CreateElement("audio", ns);
|
||||||
|
text.InnerText = p.Text;
|
||||||
|
|
||||||
|
XmlAttribute start = xml.CreateAttribute("clipBegin");
|
||||||
|
start.InnerText = ToTimeCode(p.StartTime);
|
||||||
|
audio.Attributes.Append(start);
|
||||||
|
|
||||||
|
XmlAttribute end = xml.CreateAttribute("clipEnd");
|
||||||
|
end.InnerText = ToTimeCode(p.EndTime);
|
||||||
|
audio.Attributes.Append(end);
|
||||||
|
|
||||||
|
XmlAttribute textSource = xml.CreateAttribute("src");
|
||||||
|
textSource.InnerText = $"text.xhtml#para{count}";
|
||||||
|
text.Attributes.Append(textSource);
|
||||||
|
|
||||||
|
XmlAttribute audioSource = xml.CreateAttribute("src");
|
||||||
|
audioSource.InnerText = "audio.mp3";
|
||||||
|
audio.Attributes.Append(audioSource);
|
||||||
|
|
||||||
|
bodyNode.AppendChild(paragraph);
|
||||||
|
paragraph.AppendChild(text);
|
||||||
|
paragraph.AppendChild(audio);
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToUtf8XmlString(xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
|
||||||
|
{
|
||||||
|
_errorCount = 0;
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
lines.ForEach(line => sb.AppendLine(line));
|
||||||
|
var allText = sb.ToString();
|
||||||
|
if (!allText.Contains("<smil") || !allText.Contains("</smil>"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var xml = new XmlDocument { XmlResolver = null };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
xml.LoadXml(allText);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_errorCount = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const string ns = "http://www.w3.org/ns/SMIL";
|
||||||
|
var nsmgr = new XmlNamespaceManager(xml.NameTable);
|
||||||
|
nsmgr.AddNamespace("smil", ns);
|
||||||
|
nsmgr.AddNamespace("epub", "http://www.idpf.org/2007/ops");
|
||||||
|
|
||||||
|
foreach (XmlNode node in xml.DocumentElement.SelectNodes("//smil:par", nsmgr))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var textNode = node.SelectSingleNode("smil:text", nsmgr);
|
||||||
|
var audioNode = node.SelectSingleNode("smil:audio", nsmgr);
|
||||||
|
|
||||||
|
var text = textNode.InnerText;
|
||||||
|
var start = audioNode.Attributes["clipBegin"].InnerText;
|
||||||
|
var end = audioNode.Attributes["clipEnd"].InnerText;
|
||||||
|
subtitle.Paragraphs.Add(new Paragraph(DecodeTimeCode(start), DecodeTimeCode(end), text));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||||
|
_errorCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subtitle.Renumber();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -192,6 +192,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
|||||||
new ScenaristClosedCaptions(),
|
new ScenaristClosedCaptions(),
|
||||||
new ScenaristClosedCaptionsDropFrame(),
|
new ScenaristClosedCaptionsDropFrame(),
|
||||||
new SmartTitler(),
|
new SmartTitler(),
|
||||||
|
new Smil30(),
|
||||||
new SmilTimesheetData(),
|
new SmilTimesheetData(),
|
||||||
new SmpteTt2052(),
|
new SmpteTt2052(),
|
||||||
new SoftNiSub(),
|
new SoftNiSub(),
|
||||||
|
76
src/ui/Forms/Options/Settings.Designer.cs
generated
76
src/ui/Forms/Options/Settings.Designer.cs
generated
@ -465,8 +465,8 @@
|
|||||||
this.label11 = new System.Windows.Forms.Label();
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
this.groupBoxAutoTranslateChatGpt = new System.Windows.Forms.GroupBox();
|
this.groupBoxAutoTranslateChatGpt = new System.Windows.Forms.GroupBox();
|
||||||
this.nikseTextBoxChatGptUrl = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
this.nikseTextBoxChatGptUrl = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||||
this.nikseComboBoxChatGptDelay = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
this.nikseComboBoxChatGptModel = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||||
this.labelChatGptDelay = new System.Windows.Forms.Label();
|
this.labelChatGptModel = new System.Windows.Forms.Label();
|
||||||
this.nikseTextBoxChatGptApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
this.nikseTextBoxChatGptApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||||
this.labelApiKeyChatGpt = new System.Windows.Forms.Label();
|
this.labelApiKeyChatGpt = new System.Windows.Forms.Label();
|
||||||
this.labelUrlChatGpt = new System.Windows.Forms.Label();
|
this.labelUrlChatGpt = new System.Windows.Forms.Label();
|
||||||
@ -6563,8 +6563,8 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseTextBoxChatGptUrl);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseTextBoxChatGptUrl);
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseComboBoxChatGptDelay);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseComboBoxChatGptModel);
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelChatGptDelay);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelChatGptModel);
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseTextBoxChatGptApiKey);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.nikseTextBoxChatGptApiKey);
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelApiKeyChatGpt);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelApiKeyChatGpt);
|
||||||
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelUrlChatGpt);
|
this.groupBoxAutoTranslateChatGpt.Controls.Add(this.labelUrlChatGpt);
|
||||||
@ -6585,40 +6585,40 @@
|
|||||||
this.nikseTextBoxChatGptUrl.Size = new System.Drawing.Size(384, 21);
|
this.nikseTextBoxChatGptUrl.Size = new System.Drawing.Size(384, 21);
|
||||||
this.nikseTextBoxChatGptUrl.TabIndex = 34;
|
this.nikseTextBoxChatGptUrl.TabIndex = 34;
|
||||||
//
|
//
|
||||||
// nikseComboBoxChatGptDelay
|
// nikseComboBoxChatGptModel
|
||||||
//
|
//
|
||||||
this.nikseComboBoxChatGptDelay.BackColor = System.Drawing.SystemColors.Window;
|
this.nikseComboBoxChatGptModel.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.nikseComboBoxChatGptDelay.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
this.nikseComboBoxChatGptModel.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||||
this.nikseComboBoxChatGptDelay.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
this.nikseComboBoxChatGptModel.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
|
||||||
this.nikseComboBoxChatGptDelay.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
|
this.nikseComboBoxChatGptModel.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
|
||||||
this.nikseComboBoxChatGptDelay.ButtonForeColor = System.Drawing.SystemColors.ControlText;
|
this.nikseComboBoxChatGptModel.ButtonForeColor = System.Drawing.SystemColors.ControlText;
|
||||||
this.nikseComboBoxChatGptDelay.ButtonForeColorDown = System.Drawing.Color.Orange;
|
this.nikseComboBoxChatGptModel.ButtonForeColorDown = System.Drawing.Color.Orange;
|
||||||
this.nikseComboBoxChatGptDelay.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
this.nikseComboBoxChatGptModel.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||||
this.nikseComboBoxChatGptDelay.DropDownHeight = 400;
|
this.nikseComboBoxChatGptModel.DropDownHeight = 400;
|
||||||
this.nikseComboBoxChatGptDelay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.nikseComboBoxChatGptModel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.nikseComboBoxChatGptDelay.DropDownWidth = 375;
|
this.nikseComboBoxChatGptModel.DropDownWidth = 375;
|
||||||
this.nikseComboBoxChatGptDelay.FormattingEnabled = true;
|
this.nikseComboBoxChatGptModel.FormattingEnabled = true;
|
||||||
this.nikseComboBoxChatGptDelay.Items.AddRange(new object[] {
|
this.nikseComboBoxChatGptModel.Items.AddRange(new object[] {
|
||||||
"0",
|
"gpt-3.5-turbo",
|
||||||
"20"});
|
"gpt-4"});
|
||||||
this.nikseComboBoxChatGptDelay.Location = new System.Drawing.Point(52, 109);
|
this.nikseComboBoxChatGptModel.Location = new System.Drawing.Point(52, 109);
|
||||||
this.nikseComboBoxChatGptDelay.MaxLength = 32767;
|
this.nikseComboBoxChatGptModel.MaxLength = 32767;
|
||||||
this.nikseComboBoxChatGptDelay.Name = "nikseComboBoxChatGptDelay";
|
this.nikseComboBoxChatGptModel.Name = "nikseComboBoxChatGptModel";
|
||||||
this.nikseComboBoxChatGptDelay.SelectedIndex = -1;
|
this.nikseComboBoxChatGptModel.SelectedIndex = -1;
|
||||||
this.nikseComboBoxChatGptDelay.SelectedItem = null;
|
this.nikseComboBoxChatGptModel.SelectedItem = null;
|
||||||
this.nikseComboBoxChatGptDelay.SelectedText = "";
|
this.nikseComboBoxChatGptModel.SelectedText = "";
|
||||||
this.nikseComboBoxChatGptDelay.Size = new System.Drawing.Size(340, 21);
|
this.nikseComboBoxChatGptModel.Size = new System.Drawing.Size(340, 21);
|
||||||
this.nikseComboBoxChatGptDelay.TabIndex = 38;
|
this.nikseComboBoxChatGptModel.TabIndex = 38;
|
||||||
this.nikseComboBoxChatGptDelay.UsePopupWindow = false;
|
this.nikseComboBoxChatGptModel.UsePopupWindow = false;
|
||||||
//
|
//
|
||||||
// labelChatGptDelay
|
// labelChatGptModel
|
||||||
//
|
//
|
||||||
this.labelChatGptDelay.AutoSize = true;
|
this.labelChatGptModel.AutoSize = true;
|
||||||
this.labelChatGptDelay.Location = new System.Drawing.Point(6, 112);
|
this.labelChatGptModel.Location = new System.Drawing.Point(6, 112);
|
||||||
this.labelChatGptDelay.Name = "labelChatGptDelay";
|
this.labelChatGptModel.Name = "labelChatGptModel";
|
||||||
this.labelChatGptDelay.Size = new System.Drawing.Size(34, 13);
|
this.labelChatGptModel.Size = new System.Drawing.Size(35, 13);
|
||||||
this.labelChatGptDelay.TabIndex = 37;
|
this.labelChatGptModel.TabIndex = 37;
|
||||||
this.labelChatGptDelay.Text = "Delay";
|
this.labelChatGptModel.Text = "Model";
|
||||||
//
|
//
|
||||||
// nikseTextBoxChatGptApiKey
|
// nikseTextBoxChatGptApiKey
|
||||||
//
|
//
|
||||||
@ -6986,8 +6986,8 @@
|
|||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1092, 574);
|
this.ClientSize = new System.Drawing.Size(1092, 574);
|
||||||
this.Controls.Add(this.panelShortcuts);
|
|
||||||
this.Controls.Add(this.panelAutoTranslate);
|
this.Controls.Add(this.panelAutoTranslate);
|
||||||
|
this.Controls.Add(this.panelShortcuts);
|
||||||
this.Controls.Add(this.panelVideoPlayer);
|
this.Controls.Add(this.panelVideoPlayer);
|
||||||
this.Controls.Add(this.labelUpdateFileTypeAssociationsStatus);
|
this.Controls.Add(this.labelUpdateFileTypeAssociationsStatus);
|
||||||
this.Controls.Add(this.panelGeneral);
|
this.Controls.Add(this.panelGeneral);
|
||||||
@ -7607,14 +7607,14 @@
|
|||||||
private System.Windows.Forms.LinkLabel linkLabelPapago;
|
private System.Windows.Forms.LinkLabel linkLabelPapago;
|
||||||
private System.Windows.Forms.Label label11;
|
private System.Windows.Forms.Label label11;
|
||||||
private System.Windows.Forms.GroupBox groupBoxAutoTranslateChatGpt;
|
private System.Windows.Forms.GroupBox groupBoxAutoTranslateChatGpt;
|
||||||
private System.Windows.Forms.Label labelChatGptDelay;
|
private System.Windows.Forms.Label labelChatGptModel;
|
||||||
private Controls.NikseTextBox nikseTextBoxChatGptApiKey;
|
private Controls.NikseTextBox nikseTextBoxChatGptApiKey;
|
||||||
private System.Windows.Forms.Label labelApiKeyChatGpt;
|
private System.Windows.Forms.Label labelApiKeyChatGpt;
|
||||||
private Controls.NikseTextBox nikseTextBoxChatGptUrl;
|
private Controls.NikseTextBox nikseTextBoxChatGptUrl;
|
||||||
private System.Windows.Forms.Label labelUrlChatGpt;
|
private System.Windows.Forms.Label labelUrlChatGpt;
|
||||||
private System.Windows.Forms.LinkLabel linkLabelMoreInfoChatGpt;
|
private System.Windows.Forms.LinkLabel linkLabelMoreInfoChatGpt;
|
||||||
private System.Windows.Forms.Label label10;
|
private System.Windows.Forms.Label label10;
|
||||||
private Controls.NikseComboBox nikseComboBoxChatGptDelay;
|
private Controls.NikseComboBox nikseComboBoxChatGptModel;
|
||||||
private System.Windows.Forms.Label labelShortcutsFilter;
|
private System.Windows.Forms.Label labelShortcutsFilter;
|
||||||
private Controls.NikseComboBox nikseComboBoxShortcutsFilter;
|
private Controls.NikseComboBox nikseComboBoxShortcutsFilter;
|
||||||
}
|
}
|
||||||
|
@ -912,11 +912,11 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
|||||||
nikseTextBoxDeepLApiKey.Width = nikseTextBoxDeepLUrl.Width - labelDeepLApiKey.Width - 3;
|
nikseTextBoxDeepLApiKey.Width = nikseTextBoxDeepLUrl.Width - labelDeepLApiKey.Width - 3;
|
||||||
|
|
||||||
labelApiKeyChatGpt.Text = language.GoogleTranslateApiKey;
|
labelApiKeyChatGpt.Text = language.GoogleTranslateApiKey;
|
||||||
labelChatGptDelay.Text = LanguageSettings.Current.Main.VideoControls.DelayInSeconds;
|
labelChatGptModel.Text = LanguageSettings.Current.AudioToText.Model;
|
||||||
nikseTextBoxChatGptApiKey.Left = labelApiKeyChatGpt.Right + 3;
|
nikseTextBoxChatGptApiKey.Left = labelApiKeyChatGpt.Right + 3;
|
||||||
nikseTextBoxChatGptApiKey.Width = nikseTextBoxChatGptUrl.Width - labelApiKeyChatGpt.Width - 3;
|
nikseTextBoxChatGptApiKey.Width = nikseTextBoxChatGptUrl.Width - labelApiKeyChatGpt.Width - 3;
|
||||||
nikseComboBoxChatGptDelay.Left = labelChatGptDelay.Right + 3;
|
nikseComboBoxChatGptModel.Left = labelChatGptModel.Right + 3;
|
||||||
nikseComboBoxChatGptDelay.Width = nikseTextBoxChatGptUrl.Width - labelChatGptDelay.Width - 3;
|
nikseComboBoxChatGptModel.Width = nikseTextBoxChatGptUrl.Width - labelChatGptModel.Width - 3;
|
||||||
|
|
||||||
nikseTextBoxPapagoClientSecret.Left = labelSecretPapago.Right + 3;
|
nikseTextBoxPapagoClientSecret.Left = labelSecretPapago.Right + 3;
|
||||||
nikseTextBoxPapagoClientSecret.Width = nikseTextBoxPapagoClientId.Width - labelSecretPapago.Width - 3;
|
nikseTextBoxPapagoClientSecret.Width = nikseTextBoxPapagoClientId.Width - labelSecretPapago.Width - 3;
|
||||||
@ -1150,10 +1150,10 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
|||||||
nikseTextBoxChatGptUrl.Text = Configuration.Settings.Tools.ChatGptUrl;
|
nikseTextBoxChatGptUrl.Text = Configuration.Settings.Tools.ChatGptUrl;
|
||||||
nikseTextBoxChatGptApiKey.Text = Configuration.Settings.Tools.ChatGptApiKey;
|
nikseTextBoxChatGptApiKey.Text = Configuration.Settings.Tools.ChatGptApiKey;
|
||||||
|
|
||||||
nikseComboBoxChatGptDelay.SelectedIndex = 0;
|
nikseComboBoxChatGptModel.Text = Configuration.Settings.Tools.ChatGptModel;
|
||||||
if (Configuration.Settings.Tools.ChatGptDelaySeconds == 20)
|
if (string.IsNullOrEmpty(nikseComboBoxChatGptModel.Text))
|
||||||
{
|
{
|
||||||
nikseComboBoxChatGptDelay.SelectedIndex = 1;
|
nikseComboBoxChatGptModel.Text = "gpt-3.5-turbo";
|
||||||
}
|
}
|
||||||
|
|
||||||
nikseTextBoxPapagoClientId.Text = Configuration.Settings.Tools.AutoTranslatePapagoApiKeyId;
|
nikseTextBoxPapagoClientId.Text = Configuration.Settings.Tools.AutoTranslatePapagoApiKeyId;
|
||||||
@ -2371,7 +2371,7 @@ namespace Nikse.SubtitleEdit.Forms.Options
|
|||||||
toolsSettings.AutoTranslateDeepLApiKey = nikseTextBoxDeepLApiKey.Text;
|
toolsSettings.AutoTranslateDeepLApiKey = nikseTextBoxDeepLApiKey.Text;
|
||||||
toolsSettings.ChatGptUrl = nikseTextBoxChatGptUrl.Text;
|
toolsSettings.ChatGptUrl = nikseTextBoxChatGptUrl.Text;
|
||||||
toolsSettings.ChatGptApiKey = nikseTextBoxChatGptApiKey.Text;
|
toolsSettings.ChatGptApiKey = nikseTextBoxChatGptApiKey.Text;
|
||||||
toolsSettings.ChatGptDelaySeconds = int.Parse(nikseComboBoxChatGptDelay.Text.Split()[0]);
|
toolsSettings.ChatGptModel = nikseComboBoxChatGptModel.Text;
|
||||||
toolsSettings.AutoTranslatePapagoApiKeyId = nikseTextBoxPapagoClientId.Text.Trim();
|
toolsSettings.AutoTranslatePapagoApiKeyId = nikseTextBoxPapagoClientId.Text.Trim();
|
||||||
toolsSettings.AutoTranslatePapagoApiKey = nikseTextBoxPapagoClientSecret.Text.Trim();
|
toolsSettings.AutoTranslatePapagoApiKey = nikseTextBoxPapagoClientSecret.Text.Trim();
|
||||||
|
|
||||||
|
28
src/ui/Forms/Translate/AutoTranslate.Designer.cs
generated
28
src/ui/Forms/Translate/AutoTranslate.Designer.cs
generated
@ -60,6 +60,8 @@
|
|||||||
this.subtitleListViewSource = new Nikse.SubtitleEdit.Controls.SubtitleListView();
|
this.subtitleListViewSource = new Nikse.SubtitleEdit.Controls.SubtitleListView();
|
||||||
this.comboBoxFormality = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
this.comboBoxFormality = new Nikse.SubtitleEdit.Controls.NikseComboBox();
|
||||||
this.labelFormality = new Nikse.SubtitleEdit.Controls.NikseLabel();
|
this.labelFormality = new Nikse.SubtitleEdit.Controls.NikseLabel();
|
||||||
|
this.delayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.delayToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.contextMenuStrip2.SuspendLayout();
|
this.contextMenuStrip2.SuspendLayout();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -159,9 +161,10 @@
|
|||||||
this.toolStripMenuItemStartNLLBServe,
|
this.toolStripMenuItemStartNLLBServe,
|
||||||
this.toolStripMenuItemStartNLLBApi,
|
this.toolStripMenuItemStartNLLBApi,
|
||||||
this.toolStripSeparator1,
|
this.toolStripSeparator1,
|
||||||
this.translateSingleLinesToolStripMenuItem});
|
this.translateSingleLinesToolStripMenuItem,
|
||||||
|
this.delayToolStripMenuItem});
|
||||||
this.contextMenuStrip2.Name = "contextMenuStrip1";
|
this.contextMenuStrip2.Name = "contextMenuStrip1";
|
||||||
this.contextMenuStrip2.Size = new System.Drawing.Size(197, 98);
|
this.contextMenuStrip2.Size = new System.Drawing.Size(199, 120);
|
||||||
this.contextMenuStrip2.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip2_Opening);
|
this.contextMenuStrip2.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip2_Opening);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemStartLibre
|
// toolStripMenuItemStartLibre
|
||||||
@ -203,9 +206,10 @@
|
|||||||
this.startNLLBServeServerToolStripMenuItem,
|
this.startNLLBServeServerToolStripMenuItem,
|
||||||
this.startNLLBAPIServerToolStripMenuItem,
|
this.startNLLBAPIServerToolStripMenuItem,
|
||||||
this.toolStripSeparator2,
|
this.toolStripSeparator2,
|
||||||
this.translateSingleLinesToolStripMenuItem1});
|
this.translateSingleLinesToolStripMenuItem1,
|
||||||
|
this.delayToolStripMenuItem1});
|
||||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
this.contextMenuStrip1.Size = new System.Drawing.Size(197, 98);
|
this.contextMenuStrip1.Size = new System.Drawing.Size(199, 142);
|
||||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||||
//
|
//
|
||||||
// startLibreTranslateServerToolStripMenuItem
|
// startLibreTranslateServerToolStripMenuItem
|
||||||
@ -443,6 +447,20 @@
|
|||||||
this.labelFormality.TabIndex = 113;
|
this.labelFormality.TabIndex = 113;
|
||||||
this.labelFormality.Text = "Formality:";
|
this.labelFormality.Text = "Formality:";
|
||||||
//
|
//
|
||||||
|
// delayToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.delayToolStripMenuItem.Name = "delayToolStripMenuItem";
|
||||||
|
this.delayToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
|
||||||
|
this.delayToolStripMenuItem.Text = "Delay between API calls";
|
||||||
|
this.delayToolStripMenuItem.Click += new System.EventHandler(this.delayToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// delayToolStripMenuItem1
|
||||||
|
//
|
||||||
|
this.delayToolStripMenuItem1.Name = "delayToolStripMenuItem1";
|
||||||
|
this.delayToolStripMenuItem1.Size = new System.Drawing.Size(198, 22);
|
||||||
|
this.delayToolStripMenuItem1.Text = "Delay between API calls";
|
||||||
|
this.delayToolStripMenuItem1.Click += new System.EventHandler(this.delayToolStripMenuItem1_Click);
|
||||||
|
//
|
||||||
// AutoTranslate
|
// AutoTranslate
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -519,5 +537,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem translateSingleLinesToolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem translateSingleLinesToolStripMenuItem1;
|
||||||
private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFormality;
|
private Nikse.SubtitleEdit.Controls.NikseComboBox comboBoxFormality;
|
||||||
private Nikse.SubtitleEdit.Controls.NikseLabel labelFormality;
|
private Nikse.SubtitleEdit.Controls.NikseLabel labelFormality;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem delayToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem delayToolStripMenuItem1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -109,6 +109,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
|||||||
AutoTranslate_Resize(null, null);
|
AutoTranslate_Resize(null, null);
|
||||||
UpdateTranslation();
|
UpdateTranslation();
|
||||||
MergeAndSplitHelper.MergeSplitProblems = false;
|
MergeAndSplitHelper.MergeSplitProblems = false;
|
||||||
|
ShowDelayLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeAutoTranslatorEngines()
|
private void InitializeAutoTranslatorEngines()
|
||||||
@ -625,11 +626,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
|||||||
_autoTranslator.Name == NoLanguageLeftBehindApi.StaticName || // NLLB seems to miss some text...
|
_autoTranslator.Name == NoLanguageLeftBehindApi.StaticName || // NLLB seems to miss some text...
|
||||||
_autoTranslator.Name == NoLanguageLeftBehindServe.StaticName;
|
_autoTranslator.Name == NoLanguageLeftBehindServe.StaticName;
|
||||||
|
|
||||||
var delaySeconds = 0;
|
var delaySeconds = Configuration.Settings.Tools.AutoTranslateDelaySeconds;
|
||||||
if (_autoTranslator.Name == ChatGptTranslate.StaticName)
|
|
||||||
{
|
|
||||||
delaySeconds = Configuration.Settings.Tools.ChatGptDelaySeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comboBoxSource.SelectedItem is TranslationPair source && comboBoxTarget.SelectedItem is TranslationPair target)
|
if (comboBoxSource.SelectedItem is TranslationPair source && comboBoxTarget.SelectedItem is TranslationPair target)
|
||||||
{
|
{
|
||||||
@ -1200,5 +1197,29 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void delayToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
delayToolStripMenuItem_Click(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void delayToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Configuration.Settings.Tools.AutoTranslateDelaySeconds == 0)
|
||||||
|
{
|
||||||
|
Configuration.Settings.Tools.AutoTranslateDelaySeconds = 20;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Configuration.Settings.Tools.AutoTranslateDelaySeconds = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowDelayLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowDelayLabel()
|
||||||
|
{
|
||||||
|
delayToolStripMenuItem1.Text = "Delay between API calls in seconds: " + Configuration.Settings.Tools.AutoTranslateDelaySeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user