Add simple retry for DL - thx rifatozkancomtr/dante3732 :)

Work on #8967
This commit is contained in:
Nikolaj Olsson 2024-12-24 08:32:25 +01:00
parent f041061a8e
commit ccbcc300f2
6 changed files with 34 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<Language Name="English">
<General>
<Title>Subtitle Edit</Title>
<Version>4.0.9</Version>
<Version>4.0.10</Version>
<TranslatedBy>Translated by Nikse</TranslatedBy>
<CultureName>en-US</CultureName>
<HelpFile />

View File

@ -141,6 +141,20 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
var result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
var resultContent = result.Content.ReadAsStringAsync().Result;
if (result.StatusCode == HttpStatusCode.ServiceUnavailable)
{
Task.Delay(555).Wait();
result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
resultContent = result.Content.ReadAsStringAsync().Result;
}
if (result.StatusCode == HttpStatusCode.ServiceUnavailable)
{
Task.Delay(1007).Wait();
result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
resultContent = result.Content.ReadAsStringAsync().Result;
}
if (!result.IsSuccessStatusCode)
{
SeLogger.Error("DeepLTranslate error: " + resultContent);

View File

@ -57,6 +57,20 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
var result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
var resultContent = result.Content.ReadAsStringAsync().Result;
if (result.StatusCode == HttpStatusCode.ServiceUnavailable)
{
Task.Delay(555).Wait();
result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
resultContent = result.Content.ReadAsStringAsync().Result;
}
if (result.StatusCode == HttpStatusCode.ServiceUnavailable)
{
Task.Delay(1007).Wait();
result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result;
resultContent = result.Content.ReadAsStringAsync().Result;
}
if (!result.IsSuccessStatusCode)
{
SeLogger.Error("DeepLTranslate error: " + resultContent);

View File

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json
PackageIdentifier: Nikse.SubtitleEdit
PackageVersion: 4.0.9.0
PackageVersion: 4.0.10.0
InstallerType: inno
FileExtensions:
- srt
@ -23,8 +23,8 @@ FileExtensions:
ProductCode: SubtitleEdit_is1
Installers:
- Architecture: x64
InstallerUrl: https://github.com/SubtitleEdit/subtitleedit/releases/download/4.0.9/SubtitleEdit-4.0.9-Setup.exe
InstallerSha256: F1DBC298F29AA28391977869B3955EE07CAF8622FF79C66046D6C90A4D6F77EA
InstallerUrl: https://github.com/SubtitleEdit/subtitleedit/releases/download/4.0.10/SubtitleEdit-4.0.10-Setup.exe
InstallerSha256: 1677D2E5DABB08EA76B4B32DBCDE302B395AD8D5A613AC34C4E582B3502CC66F
ManifestType: installer
ManifestVersion: 1.6.0

View File

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json
PackageIdentifier: Nikse.SubtitleEdit
PackageVersion: 4.0.9.0
PackageVersion: 4.0.10.0
PackageLocale: en-US
Publisher: Nikse
PublisherUrl: https://www.nikse.dk/

View File

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json
PackageIdentifier: Nikse.SubtitleEdit
PackageVersion: 4.0.9.0
PackageVersion: 4.0.10.0
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.6.0