From 32146220a8d0fff76bb78999024e50e0238c67f0 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 13 Jun 2023 21:10:06 +0200 Subject: [PATCH] Work on WebVTT --- src/libse/Common/WebVttHelper.cs | 6 +++++- src/ui/Controls/VideoPlayerContainer.cs | 1 + src/ui/Forms/Main.cs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libse/Common/WebVttHelper.cs b/src/libse/Common/WebVttHelper.cs index c9a54b8ca..bc346ac62 100644 --- a/src/libse/Common/WebVttHelper.cs +++ b/src/libse/Common/WebVttHelper.cs @@ -385,10 +385,14 @@ namespace Nikse.SubtitleEdit.Core.Common text = text.Remove(idx, 4); } } - else + else if (text.Contains("" + text + ""; + } return text; } diff --git a/src/ui/Controls/VideoPlayerContainer.cs b/src/ui/Controls/VideoPlayerContainer.cs index 2cbb06e39..7dabedc39 100644 --- a/src/ui/Controls/VideoPlayerContainer.cs +++ b/src/ui/Controls/VideoPlayerContainer.cs @@ -478,6 +478,7 @@ namespace Nikse.SubtitleEdit.Controls } else if (uiFormat.Name == WebVTT.NameOfFormat || uiFormat.Name == WebVTTFileWithLineNumber.NameOfFormat) { + //TODO: add some caching!? var defaultStyle = GetMpvPreviewStyle(Configuration.Settings.General); defaultStyle.BorderStyle = "3"; subtitle = new Subtitle(subtitle); diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index d77f1cd9c..e0cd02202 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -14052,7 +14052,7 @@ namespace Nikse.SubtitleEdit.Forms var c = ColorTranslator.FromHtml(color); var styleWithColor = WebVttHelper.AddStyleFromColor(c); subtitle.Header = WebVttHelper.AddStyleToHeader(_subtitle.Header, styleWithColor); - WebVttHelper.AddStyleToText(p.Text, styleWithColor); + p.Text = WebVttHelper.AddStyleToText(p.Text, styleWithColor); } catch {