|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
using MediaBrowser.Model.Extensions;
|
|
|
|
|
using System;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
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
|
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|
|
|
|
{
|
|
|
|
|
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++;
|
|
|
|
@ -63,11 +63,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|
|
|
|
{
|
|
|
|
|
TimeSpan span;
|
|
|
|
|
return TimeSpan.TryParseExact(time, @"h\:mm\:ss\.ff", _usCulture, out span)
|
|
|
|
|
? span.Ticks: 0;
|
|
|
|
|
? 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")},
|
|
|
|
|