mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
commit
6960f0af67
1 changed files with 7 additions and 4 deletions
|
@ -183,11 +183,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
|
|
||||||
private async Task<Stream> GetSubtitleStream(string path, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken)
|
private async Task<Stream> GetSubtitleStream(string path, MediaProtocol protocol, bool requiresCharset, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (requiresCharset)
|
using (var stream = await GetStream(path, protocol, cancellationToken).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
using (var stream = await GetStream(path, protocol, cancellationToken).ConfigureAwait(false))
|
if (requiresCharset)
|
||||||
{
|
{
|
||||||
var result = CharsetDetector.DetectFromStream(stream).Detected;
|
var result = CharsetDetector.DetectFromStream(stream).Detected;
|
||||||
|
stream.Position = 0;
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
@ -199,9 +200,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
return new MemoryStream(Encoding.UTF8.GetBytes(text));
|
return new MemoryStream(Encoding.UTF8.GetBytes(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return File.OpenRead(path);
|
return stream;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<SubtitleInfo> GetReadableFile(
|
private async Task<SubtitleInfo> GetReadableFile(
|
||||||
|
@ -745,6 +746,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
Url = path,
|
Url = path,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
|
|
||||||
|
// Needed for seeking
|
||||||
BufferContent = true
|
BufferContent = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue