|
|
|
@ -26,7 +26,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|
|
|
|
|
|
|
|
|
public async Task<List<string>> DownloadSubtitles(Video video,
|
|
|
|
|
List<MediaStream> mediaStreams,
|
|
|
|
|
bool skipIfGraphicalSubtitlesPresent,
|
|
|
|
|
bool skipIfEmbeddedSubtitlesPresent,
|
|
|
|
|
bool skipIfAudioTrackMatches,
|
|
|
|
|
IEnumerable<string> languages,
|
|
|
|
|
CancellationToken cancellationToken)
|
|
|
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfGraphicalSubtitlesPresent, skipIfAudioTrackMatches, lang, mediaType, cancellationToken)
|
|
|
|
|
var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfEmbeddedSubtitlesPresent, skipIfAudioTrackMatches, lang, mediaType, cancellationToken)
|
|
|
|
|
.ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
if (downloaded)
|
|
|
|
@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|
|
|
|
|
|
|
|
|
private async Task<bool> DownloadSubtitles(Video video,
|
|
|
|
|
List<MediaStream> mediaStreams,
|
|
|
|
|
bool skipIfGraphicalSubtitlesPresent,
|
|
|
|
|
bool skipIfEmbeddedSubtitlesPresent,
|
|
|
|
|
bool skipIfAudioTrackMatches,
|
|
|
|
|
string language,
|
|
|
|
|
VideoContentType mediaType,
|
|
|
|
@ -107,8 +107,8 @@ namespace MediaBrowser.Providers.MediaInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// There's an internal subtitle stream for this language
|
|
|
|
|
if (skipIfGraphicalSubtitlesPresent &&
|
|
|
|
|
mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle && !i.IsTextSubtitleStream && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
if (skipIfEmbeddedSubtitlesPresent &&
|
|
|
|
|
mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|