Minor fixes

This commit is contained in:
Nikolaj Olsson 2024-10-17 08:03:45 +02:00
parent 7040a121b7
commit e4574183f7
6 changed files with 30 additions and 8 deletions

View File

@ -1,7 +1,6 @@
using Nikse.SubtitleEdit.Core.Common; using Nikse.SubtitleEdit.Core.Common;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using static System.Net.WebRequestMethods;
namespace Nikse.SubtitleEdit.Core.AudioToText namespace Nikse.SubtitleEdit.Core.AudioToText
{ {

View File

@ -26,7 +26,12 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
public void Initialize() public void Initialize()
{ {
_apiUrl = Configuration.Settings.Tools.AutoTranslateDeepLUrl; if (string.IsNullOrEmpty(Configuration.Settings.Tools.AutoTranslateDeepLXUrl))
{
Configuration.Settings.Tools.AutoTranslateDeepLXUrl = "http://localhost:1188";
}
_apiUrl = Configuration.Settings.Tools.AutoTranslateDeepLXUrl;
_client = new HttpClient(); _client = new HttpClient();
_client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/')); _client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/'));
} }

View File

@ -5394,7 +5394,7 @@ namespace Nikse.SubtitleEdit.Forms
return DialogResult.No; return DialogResult.No;
} }
MessageBox.Show("Ups - save original does not support this format - please go to Github and create an issue!"); MessageBox.Show("Oops - save original does not support this format - please go to Github and create an issue!");
} }
string allText = subAlt.ToText(format); string allText = subAlt.ToText(format);

View File

@ -123,7 +123,6 @@ namespace Nikse.SubtitleEdit.Forms.Translate
new GoogleTranslateV2(), new GoogleTranslateV2(),
new MicrosoftTranslator(), new MicrosoftTranslator(),
new DeepLTranslate(), new DeepLTranslate(),
new DeepLXTranslate(),
new LibreTranslate(), new LibreTranslate(),
new MyMemoryApi(), new MyMemoryApi(),
new ChatGptTranslate(), new ChatGptTranslate(),
@ -134,6 +133,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate
new OpenRouterTranslate(), new OpenRouterTranslate(),
new GeminiTranslate(), new GeminiTranslate(),
new PapagoTranslate(), new PapagoTranslate(),
new DeepLXTranslate(),
new NoLanguageLeftBehindServe(), new NoLanguageLeftBehindServe(),
new NoLanguageLeftBehindApi(), new NoLanguageLeftBehindApi(),
}; };
@ -230,6 +230,11 @@ namespace Nikse.SubtitleEdit.Forms.Translate
if (engineType == typeof(DeepLXTranslate)) if (engineType == typeof(DeepLXTranslate))
{ {
if (string.IsNullOrEmpty(Configuration.Settings.Tools.AutoTranslateDeepLXUrl))
{
Configuration.Settings.Tools.AutoTranslateDeepLXUrl = "http://localhost:1188";
}
FillUrls(new List<string> FillUrls(new List<string>
{ {
Configuration.Settings.Tools.AutoTranslateDeepLXUrl, Configuration.Settings.Tools.AutoTranslateDeepLXUrl,
@ -1065,6 +1070,19 @@ namespace Nikse.SubtitleEdit.Forms.Translate
UiUtil.ShowHelp("#translation"); UiUtil.ShowHelp("#translation");
} }
} }
else if (linesTranslate == 0 && engineType == typeof(DeepLXTranslate) && exception.Message.Contains("No connection could be made because the target machine actively refused it"))
{
MessageBox.Show(
this, "You need a local API to use DeepLX. Run ths docker command: "+ Environment.NewLine +
"docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest" + Environment.NewLine +
Environment.NewLine +
exception.Message + Environment.NewLine +
Environment.NewLine +
"For more information visit: " + new DeepLXTranslate().Url,
Text,
MessageBoxButtons.OKCancel,
MessageBoxIcon.Error);
}
else if (linesTranslate == 0 && else if (linesTranslate == 0 &&
(nikseComboBoxUrl.Text.Contains("//192.", StringComparison.OrdinalIgnoreCase) || (nikseComboBoxUrl.Text.Contains("//192.", StringComparison.OrdinalIgnoreCase) ||
nikseComboBoxUrl.Text.Contains("//127.", StringComparison.OrdinalIgnoreCase) || nikseComboBoxUrl.Text.Contains("//127.", StringComparison.OrdinalIgnoreCase) ||

View File

@ -319,7 +319,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
} }
catch (Exception exception) catch (Exception exception)
{ {
MessageBox.Show("Ups: " + exception.Message + Environment.NewLine + exception.Message); MessageBox.Show("Oops: " + exception.Message + Environment.NewLine + exception.Message);
SeLogger.Error(exception, $"{Text}: Error running engine {nikseComboBoxEngine.Text} with video {_videoFileName}"); SeLogger.Error(exception, $"{Text}: Error running engine {nikseComboBoxEngine.Text} with video {_videoFileName}");
} }
} }
@ -2230,7 +2230,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
var ok = GenerateParagraphAudio(sub, false, waveFileNameOnly); var ok = GenerateParagraphAudio(sub, false, waveFileNameOnly);
if (!ok) if (!ok)
{ {
MessageBox.Show(this, "Ups, voice generation failed!"); MessageBox.Show(this, "Oops, voice generation failed!");
return; return;
} }

View File

@ -41,7 +41,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary
{ {
if (bob.ExpandCount > 0) if (bob.ExpandCount > 0)
{ {
System.Windows.Forms.MessageBox.Show("Ups, expand image in CompareImages!"); System.Windows.Forms.MessageBox.Show("Oops, expand image in CompareImages!");
} }
bob.Save(gz); bob.Save(gz);
@ -50,7 +50,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary
{ {
if (bob.ExpandCount == 0) if (bob.ExpandCount == 0)
{ {
System.Windows.Forms.MessageBox.Show("Ups, not expanded image in CompareImagesExpanded!"); System.Windows.Forms.MessageBox.Show("Oops, not expanded image in CompareImagesExpanded!");
} }
bob.Save(gz); bob.Save(gz);