diff options
| author | Tthecreator <epostvanthomas@kpnmail.nl> | 2019-01-22 15:22:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 15:22:42 +0000 |
| commit | 189b99df16bd4c93cc96422d7282d01d9ff5b82f (patch) | |
| tree | 26d7da95fe3e3b2772b8b39a2463a6c0ac7652fc /MediaBrowser.MediaEncoding/Subtitles/AssParser.cs | |
| parent | a00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff) | |
| parent | edcfd8b565f632088c8b1f826db8e2fbecf9790d (diff) | |
Merge pull request #1 from jellyfin/dev
Update from jellyfin repo
Diffstat (limited to 'MediaBrowser.MediaEncoding/Subtitles/AssParser.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Subtitles/AssParser.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs index 73df2b1e0..605504418 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs @@ -1,4 +1,3 @@ -using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; using System.Globalization; @@ -6,6 +5,7 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Threading; +using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.MediaEncoding.Subtitles @@ -17,13 +17,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles public SubtitleTrackInfo Parse(Stream stream, CancellationToken cancellationToken) { var trackInfo = new SubtitleTrackInfo(); - List<SubtitleTrackEvent> trackEvents = new List<SubtitleTrackEvent>(); + var trackEvents = new List<SubtitleTrackEvent>(); var eventIndex = 1; using (var reader = new StreamReader(stream)) { string line; while (reader.ReadLine() != "[Events]") - {} + { } var headers = ParseFieldHeaders(reader.ReadLine()); while ((line = reader.ReadLine()) != null) @@ -34,9 +34,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles { continue; } - if(line.StartsWith("[")) + if (line.StartsWith("[")) break; - if(string.IsNullOrEmpty(line)) + if (string.IsNullOrEmpty(line)) continue; var subEvent = new SubtitleTrackEvent { Id = eventIndex.ToString(_usCulture) }; eventIndex++; @@ -61,13 +61,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles long GetTicks(string time) { - TimeSpan span; - return TimeSpan.TryParseExact(time, @"h\:mm\:ss\.ff", _usCulture, out span) - ? span.Ticks: 0; + return TimeSpan.TryParseExact(time, @"h\:mm\:ss\.ff", _usCulture, out var span) + ? span.Ticks : 0; } - private Dictionary<string,int> ParseFieldHeaders(string line) { - var fields = line.Substring(8).Split(',').Select(x=>x.Trim()).ToList(); + private Dictionary<string, int> ParseFieldHeaders(string line) + { + var fields = line.Substring(8).Split(',').Select(x => x.Trim()).ToList(); var result = new Dictionary<string, int> { {"Start", fields.IndexOf("Start")}, |
