mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-23 18:50:26 +00:00
Merge pull request #2582 from Bond-009/subs
Fix subtitles
(cherry picked from commit 6960f0af67)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
committed by
Joshua M. Boniface
parent
cb91595a24
commit
89fc5aa11a
@@ -183,11 +183,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
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;
|
||||
stream.Position = 0;
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
@@ -199,9 +200,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
return new MemoryStream(Encoding.UTF8.GetBytes(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return File.OpenRead(path);
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<SubtitleInfo> GetReadableFile(
|
||||
@@ -745,6 +746,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
{
|
||||
Url = path,
|
||||
CancellationToken = cancellationToken,
|
||||
|
||||
// Needed for seeking
|
||||
BufferContent = true
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user