aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs
diff options
context:
space:
mode:
authorNick <20588554+nicknsy@users.noreply.github.com>2023-10-18 19:27:05 -0700
committerNick <20588554+nicknsy@users.noreply.github.com>2023-10-18 19:27:05 -0700
commitcd662506a1f63f9b20e7f5caa9b671eb3d71ea5a (patch)
treeb58f7158e21e7ed21d77b0f0abfce23d796b3fe3 /MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs
parentc7feea27fde8af60984c8fe41444dc245dbde395 (diff)
parentde08d38a6f2a6e773fa1000574e08322605b56d3 (diff)
Merge branch 'master' into trickplay
Diffstat (limited to 'MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs')
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs b/MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs
index 143c010b7..86f77aa06 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SrtWriter.cs
@@ -11,8 +11,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
/// <summary>
/// SRT subtitle writer.
/// </summary>
- public class SrtWriter : ISubtitleWriter
+ public partial class SrtWriter : ISubtitleWriter
{
+ [GeneratedRegex(@"\\n", RegexOptions.IgnoreCase)]
+ private static partial Regex NewLineEscapedRegex();
+
/// <inheritdoc />
public void Write(SubtitleTrackInfo info, Stream stream, CancellationToken cancellationToken)
{
@@ -35,7 +38,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
var text = trackEvent.Text;
// TODO: Not sure how to handle these
- text = Regex.Replace(text, @"\\n", " ", RegexOptions.IgnoreCase);
+ text = NewLineEscapedRegex().Replace(text, " ");
writer.WriteLine(text);
writer.WriteLine();