mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
A few minor updates
This commit is contained in:
parent
82a1fbb234
commit
aa37d8c74e
@ -9,6 +9,7 @@
|
||||
* Add new json subtitle format - thx Lucretia
|
||||
* Add auto-translate via Papago
|
||||
* Add new shortcut "Set end and start of next after gap" - thx rRobis
|
||||
* Allow configure of Whisper post-processing - thx raphaelomoreira
|
||||
* IMPROVED:
|
||||
* Update Polish translation - thx admas
|
||||
* Update Finnish translation - thx Teijo S
|
||||
@ -32,6 +33,7 @@
|
||||
* Only add recent file if saved - thx F5System
|
||||
* Fix for mouse wheel scroll direction in video player - thx Peter
|
||||
* Fix for ASSA border width in export to image based format - thx Christian
|
||||
* Fix crash in generating ASSA borders with odd video resolution - thx Leon
|
||||
|
||||
|
||||
4.0.2 (19th November 2023)
|
||||
|
@ -940,4 +940,6 @@
|
||||
<word>yukina</word>
|
||||
<word>zinc</word>
|
||||
<word>zirconium</word>
|
||||
<word>fenugreek</word>
|
||||
<word>pled</word>
|
||||
</words>
|
@ -2989,6 +2989,7 @@ This file is case sensitive.
|
||||
<name>Katie</name>
|
||||
<name>Katrina</name>
|
||||
<name>Katrine</name>
|
||||
<name>Katsumoto</name>
|
||||
<name>Katy</name>
|
||||
<name>Katya</name>
|
||||
<name>Kaufman</name>
|
||||
|
@ -27,7 +27,11 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
|
||||
_httpClient.BaseAddress = new Uri(Configuration.Settings.Tools.ChatGptUrl);
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + Configuration.Settings.Tools.ChatGptApiKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ChatGptApiKey))
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + Configuration.Settings.Tools.ChatGptApiKey);
|
||||
}
|
||||
}
|
||||
|
||||
public List<TranslationPair> GetSupportedSourceLanguages()
|
||||
|
@ -758,7 +758,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
|
||||
private static readonly HashSet<char> NeutralSentenceEndingChars = new HashSet<char>
|
||||
{
|
||||
'.', '!', '?', ']', ')', '…', '♪', '؟'
|
||||
'.', '!', '?', ']', ')', '…', '♪', '؟', '。', '?'
|
||||
};
|
||||
|
||||
private static readonly HashSet<char> GreekSentenceEndingChars = new HashSet<char>
|
||||
|
@ -419,6 +419,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
buttonAdvanced.Enabled = false;
|
||||
comboBoxLanguages.Enabled = false;
|
||||
comboBoxModels.Enabled = false;
|
||||
linkLabelPostProcessingConfigure.Enabled = false;
|
||||
var waveFileName = GenerateWavFile(_videoFileName, _audioTrackNumber);
|
||||
if (_cancel)
|
||||
{
|
||||
@ -2121,6 +2122,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
buttonAdvanced.Enabled = true;
|
||||
comboBoxLanguages.Enabled = true;
|
||||
comboBoxModels.Enabled = true;
|
||||
linkLabelPostProcessingConfigure.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
groupBoxInputFiles.Enabled = false;
|
||||
comboBoxLanguages.Enabled = false;
|
||||
comboBoxModels.Enabled = false;
|
||||
linkLabelPostProcessingConfigure.Enabled = false;
|
||||
_batchFileNumber = 0;
|
||||
var postProcessor = new AudioToTextPostProcessor(_languageCode)
|
||||
{
|
||||
@ -148,6 +149,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
|
||||
buttonGenerate.Enabled = false;
|
||||
buttonDownload.Enabled = false;
|
||||
comboBoxModels.Enabled = false;
|
||||
linkLabelPostProcessingConfigure.Enabled = false;
|
||||
comboBoxLanguages.Enabled = false;
|
||||
var waveFileName = videoFileName;
|
||||
|
||||
|
@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
||||
@ -126,7 +127,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
||||
text = string.Empty;
|
||||
}
|
||||
|
||||
if (text.Length > 500)
|
||||
if (ShouldSwitchToTextBox(text))
|
||||
{
|
||||
seTextBox2.ReadOnly = true;
|
||||
seTextBox2.Text = text;
|
||||
@ -149,6 +150,22 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
|
||||
labelText.Text = text;
|
||||
}
|
||||
|
||||
private bool ShouldSwitchToTextBox(string text)
|
||||
{
|
||||
if (text.Length > 500)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var arr = text.SplitToLines();
|
||||
if (arr.Any(p => p.Length > 140))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void InitializeButtons(MessageBoxButtons buttons)
|
||||
{
|
||||
var buttonControls = new List<Button>();
|
||||
|
@ -111,11 +111,11 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
new MicrosoftTranslator(),
|
||||
new DeepLTranslate(),
|
||||
new LibreTranslate(),
|
||||
new NoLanguageLeftBehindServe(),
|
||||
new NoLanguageLeftBehindApi(),
|
||||
new MyMemoryApi(),
|
||||
new ChatGptTranslate(),
|
||||
new PapagoTranslate(),
|
||||
new NoLanguageLeftBehindServe(),
|
||||
new NoLanguageLeftBehindApi(),
|
||||
};
|
||||
|
||||
nikseComboBoxEngine.Items.Clear();
|
||||
@ -534,13 +534,6 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
_autoTranslator = GetCurrentEngine();
|
||||
var engineType = _autoTranslator.GetType();
|
||||
|
||||
if (nikseTextBoxApiKey.Visible && string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text) && engineType != typeof(MyMemoryApi))
|
||||
{
|
||||
MessageBox.Show(this, string.Format(LanguageSettings.Current.GoogleTranslate.XRequiresAnApiKey, _autoTranslator.Name), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
nikseTextBoxApiKey.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
SaveSettings(engineType);
|
||||
|
||||
buttonOK.Enabled = false;
|
||||
@ -562,7 +555,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
var linesTranslated = 0;
|
||||
|
||||
var forceSingleLineMode = translateSingleLinesToolStripMenuItem.Checked ||
|
||||
_autoTranslator.Name == NoLanguageLeftBehindApi.StaticName ||
|
||||
_autoTranslator.Name == NoLanguageLeftBehindApi.StaticName || // NLLB seems to miss some text...
|
||||
_autoTranslator.Name == NoLanguageLeftBehindServe.StaticName;
|
||||
|
||||
var delaySeconds = 0;
|
||||
@ -680,6 +673,22 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
private void HandleError(Exception exception, int linesTranslate, Type engineType)
|
||||
{
|
||||
SeLogger.Error(exception);
|
||||
|
||||
if (nikseTextBoxApiKey.Visible &&
|
||||
string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text) &&
|
||||
engineType != typeof(MyMemoryApi))
|
||||
{
|
||||
MessageBox.Show(this, string.Format(LanguageSettings.Current.GoogleTranslate.XRequiresAnApiKey, _autoTranslator.Name), Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
nikseTextBoxApiKey.Focus();
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
while (count < 10 && exception.InnerException != null)
|
||||
{
|
||||
exception = exception.InnerException;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (linesTranslate == 0 && engineType == typeof(LibreTranslate) && nikseComboBoxUrl.Text.Contains("https://libretranslate.com", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var dr = MessageBox.Show(
|
||||
@ -736,12 +745,16 @@ namespace Nikse.SubtitleEdit.Forms.Translate
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace, MessageBoxIcon.Error);
|
||||
MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace +
|
||||
Environment.NewLine +
|
||||
_autoTranslator.Error, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace, MessageBoxIcon.Error);
|
||||
MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace +
|
||||
Environment.NewLine +
|
||||
_autoTranslator.Error, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user