From ac83effd44fe38a8fa4a6fb6df483fa88cfaa7a9 Mon Sep 17 00:00:00 2001 From: Joe Rogers <1337joe@gmail.com> Date: Thu, 10 Mar 2022 22:02:46 +0100 Subject: [PATCH] Match external sub/audio stream adding logic --- MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 26ff0412b..4a289b3ab 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -594,7 +594,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - video.SubtitleFiles = externalSubtitleStreams.Select(i => i.Path).ToArray(); + video.SubtitleFiles = externalSubtitleStreams.Select(i => i.Path).Distinct().ToArray(); currentStreams.AddRange(externalSubtitleStreams); } @@ -615,10 +615,9 @@ namespace MediaBrowser.Providers.MediaInfo var startIndex = currentStreams.Count == 0 ? 0 : currentStreams.Max(i => i.Index) + 1; var externalAudioStreams = await _audioResolver.GetExternalStreamsAsync(video, startIndex, options.DirectoryService, false, cancellationToken).ConfigureAwait(false); - currentStreams = currentStreams.Concat(externalAudioStreams).ToList(); + video.AudioFiles = externalAudioStreams.Select(i => i.Path).Distinct().ToArray(); - // Select all external audio file paths - video.AudioFiles = currentStreams.Where(i => i.Type == MediaStreamType.Audio && i.IsExternal).Select(i => i.Path).Distinct().ToArray(); + currentStreams.AddRange(externalAudioStreams); } ///