Minor fixes

This commit is contained in:
niksedk 2021-11-17 10:21:33 +01:00
parent a2c9ff1a86
commit 927358d310
4 changed files with 27 additions and 13 deletions

View File

@ -1357,7 +1357,7 @@ To use an API key go to "Options -> Settings -> Tools" to enter your Googl
<ApplyCustomOverrideTag>Apply custom override tags...</ApplyCustomOverrideTag> <ApplyCustomOverrideTag>Apply custom override tags...</ApplyCustomOverrideTag>
<SetPosition>Set position...</SetPosition> <SetPosition>Set position...</SetPosition>
<GenerateProgressBar>Generate progress bar...</GenerateProgressBar> <GenerateProgressBar>Generate progress bar...</GenerateProgressBar>
<AssaResolutionChanger>Change script resolution...</AssaResolutionChanger> <AssaResolutionChanger>Change ASSA script resolution...</AssaResolutionChanger>
<FixCommonErrorsInSelectedLines>Fix common errors in selected lines...</FixCommonErrorsInSelectedLines> <FixCommonErrorsInSelectedLines>Fix common errors in selected lines...</FixCommonErrorsInSelectedLines>
<ChangeCasingForSelectedLines>Change casing for selected lines...</ChangeCasingForSelectedLines> <ChangeCasingForSelectedLines>Change casing for selected lines...</ChangeCasingForSelectedLines>
<SaveSelectedLines>Save selected lines as...</SaveSelectedLines> <SaveSelectedLines>Save selected lines as...</SaveSelectedLines>

View File

@ -897,11 +897,25 @@ namespace Nikse.SubtitleEdit.Core.Common
text = text.Replace("<i></i>", string.Empty); text = text.Replace("<i></i>", string.Empty);
text = text.Replace("</i><i>", string.Empty); text = text.Replace("</i><i>", string.Empty);
text = text.Replace("</i> <i>", " "); if (!text.Contains('@'))
text = text.Replace("<i> </i>", " "); {
text = text.Replace("<i> </i>", " "); text = text.Replace("</i> <i>", "@");
text = text.Replace(" ", " "); text = text.Replace("<i> </i>", "@");
text = text.Replace(" ", " "); text = text.Replace("<i> </i>", "@");
text = text.Replace("@ ", " ");
text = text.Replace("@ ", " ");
text = text.Replace(" @", " ");
text = text.Replace(" @", " ");
text = text.Replace("@", " ");
}
else
{
text = text.Replace("</i> <i>", " ");
text = text.Replace("<i> </i>", " ");
text = text.Replace("<i> </i>", " ");
text = text.Replace(" ", " ");
text = text.Replace(" ", " ");
}
return preTags + text; return preTags + text;
} }

View File

@ -11,7 +11,7 @@ namespace Nikse.SubtitleEdit.Forms
public sealed partial class DownloadYouTubeDl : Form public sealed partial class DownloadYouTubeDl : Form
{ {
public const string Url = "https://github.com/ytdl-org/youtube-dl/releases/download/2021.06.06/youtube-dl.exe"; public const string Url = "https://github.com/ytdl-org/youtube-dl/releases/download/2021.06.06/youtube-dl.exe";
public const string Sha512Hash = "78c009f4cf8ae56db150800d55faaac97c127c76c89715b23fe406d85c3c0628"; public const string Sha512Hash = "8f0fd27419ef340d64bff928567b0e4b03d47ca19094b409605ad71ec2b5293a79f814dd2cd4591719a7e386b4041973353fbe90124dbfd4d004b19ea31457ed";
public bool AutoClose { get; internal set; } public bool AutoClose { get; internal set; }
public DownloadYouTubeDl() public DownloadYouTubeDl()
@ -85,10 +85,10 @@ namespace Nikse.SubtitleEdit.Forms
Directory.CreateDirectory(folder); Directory.CreateDirectory(folder);
} }
var hash = GetSha256Hash(e.Result); var hash = GetSha512Hash(e.Result);
if (hash != Sha512Hash) if (hash != Sha512Hash)
{ {
MessageBox.Show("youtube-dl SHA2-512 hash does not match!"); MessageBox.Show("youtube-dl SHA-512 hash does not match!");
return; return;
} }
@ -107,14 +107,14 @@ namespace Nikse.SubtitleEdit.Forms
labelPleaseWait.Text = string.Format(LanguageSettings.Current.SettingsFfmpeg.XDownloadOk, "youtube-dl"); labelPleaseWait.Text = string.Format(LanguageSettings.Current.SettingsFfmpeg.XDownloadOk, "youtube-dl");
} }
private static string GetSha256Hash(byte[] buffer) private static string GetSha512Hash(byte[] buffer)
{ {
using (var ms = new MemoryStream(buffer)) using (var ms = new MemoryStream(buffer))
using (var bs = new BufferedStream(ms)) using (var bs = new BufferedStream(ms))
{ {
using (var sha256 = new SHA256Managed()) using (var sha512 = new SHA512Managed())
{ {
byte[] hash = sha256.ComputeHash(bs); byte[] hash = sha512.ComputeHash(bs);
string hashString = string.Empty; string hashString = string.Empty;
foreach (byte x in hash) foreach (byte x in hash)
{ {

View File

@ -1899,7 +1899,7 @@ namespace Nikse.SubtitleEdit.Logic
ApplyCustomOverrideTag = "Apply custom override tags...", ApplyCustomOverrideTag = "Apply custom override tags...",
SetPosition = "Set position...", SetPosition = "Set position...",
GenerateProgressBar = "Generate progress bar...", GenerateProgressBar = "Generate progress bar...",
AssaResolutionChanger = "Change script resolution...", AssaResolutionChanger = "Change ASSA script resolution...",
FixCommonErrorsInSelectedLines = "Fix common errors in selected lines...", FixCommonErrorsInSelectedLines = "Fix common errors in selected lines...",
ChangeCasingForSelectedLines = "Change casing for selected lines...", ChangeCasingForSelectedLines = "Change casing for selected lines...",
SaveSelectedLines = "Save selected lines as...", SaveSelectedLines = "Save selected lines as...",