aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-07-31 10:05:27 -0600
committercrobibero <cody@robibe.ro>2020-07-31 10:05:27 -0600
commitf516cf9c4c273bf1de68c3a281bf6d27627a2de6 (patch)
treeef74634ff350ab183d980b2160297795e71cee61 /MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
parentf5385e4735849cbb1552e69faa0116e5498b3688 (diff)
parentcb31aba5ddea9b961872946ee2d79fdac91de293 (diff)
Merge remote-tracking branch 'upstream/api-migration' into api-dlna
Diffstat (limited to 'MediaBrowser.MediaEncoding/Subtitles/AssParser.cs')
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/AssParser.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
index 293cf5ea5..0e2d70017 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
@@ -23,6 +23,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
string line;
while (reader.ReadLine() != "[Events]")
{ }
+
var headers = ParseFieldHeaders(reader.ReadLine());
while ((line = reader.ReadLine()) != null)
@@ -33,10 +34,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
continue;
}
+
if (line.StartsWith("["))
+ {
break;
- if (string.IsNullOrEmpty(line))
- continue;
+ }
+
var subEvent = new SubtitleTrackEvent { Id = eventIndex.ToString(_usCulture) };
eventIndex++;
var sections = line.Substring(10).Split(',');
@@ -54,6 +57,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
trackEvents.Add(subEvent);
}
}
+
trackInfo.TrackEvents = trackEvents.ToArray();
return trackInfo;
}
@@ -110,11 +114,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
pre = s.Substring(0, 5) + "}";
}
+
int indexOfEnd = p.Text.IndexOf('}');
p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1);
indexOfBegin = p.Text.IndexOf('{');
}
+
p.Text = pre + p.Text;
}
}