subtitle parsing fixes

This commit is contained in:
Luke Pulverenti
2015-03-26 00:44:24 -04:00
parent 9f191a3598
commit 70fb64cc05
11 changed files with 508 additions and 47 deletions

View File

@@ -43,10 +43,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
subEvent.StartPositionTicks = GetTicks(sections[headers["Start"]]);
subEvent.EndPositionTicks = GetTicks(sections[headers["End"]]);
//RemoteNativeFormatting(subEvent);
subEvent.Text = string.Join(",", sections.Skip(headers["Text"]));
subEvent.Text = subEvent.Text.Replace(@"\N", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
RemoteNativeFormatting(subEvent);
subEvent.Text = subEvent.Text.Replace("\\n", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
subEvent.Text = Regex.Replace(subEvent.Text, @"\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}", string.Empty, RegexOptions.IgnoreCase);
trackInfo.TrackEvents.Add(subEvent);

View File

@@ -148,8 +148,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
public static string GetFormattedText(string text)
{
text = text.Replace("\\n", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase)
.Replace("\\n", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
text = text.Replace("\\n", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
bool italic = false;