From d29b85a134ba4630178a48424b7eb54402c5c574 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Thu, 25 Apr 2024 15:02:01 +0200 Subject: Fix multiple intro providers and remove unneeded ToLists (#11431) --- Emby.Server.Implementations/Library/LibraryManager.cs | 9 ++++++--- Emby.Server.Implementations/Library/MediaSourceManager.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations/Library') diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 7b3871a9b..3e41a5048 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -44,7 +44,6 @@ using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Tasks; using Microsoft.Extensions.Logging; -using TMDbLib.Objects.Authentication; using Episode = MediaBrowser.Controller.Entities.TV.Episode; using EpisodeInfo = Emby.Naming.TV.EpisodeInfo; using Genre = MediaBrowser.Controller.Entities.Genre; @@ -1612,14 +1611,18 @@ namespace Emby.Server.Implementations.Library /// IEnumerable{System.String}. public async Task> GetIntros(BaseItem item, User user) { + if (IntroProviders.Length == 0) + { + return []; + } + var tasks = IntroProviders - .Take(1) .Select(i => GetIntros(i, item, user)); var items = await Task.WhenAll(tasks).ConfigureAwait(false); return items - .SelectMany(i => i.ToArray()) + .SelectMany(i => i) .Select(ResolveIntro) .Where(i => i is not null)!; // null values got filtered out } diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index 9658bd566..5ec333cb1 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Library var tasks = _providers.Select(i => GetDynamicMediaSources(item, i, cancellationToken)); var results = await Task.WhenAll(tasks).ConfigureAwait(false); - return results.SelectMany(i => i.ToList()); + return results.SelectMany(i => i); } private async Task> GetDynamicMediaSources(BaseItem item, IMediaSourceProvider provider, CancellationToken cancellationToken) -- cgit v1.2.3