mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 22:17:25 -04:00
Fix multiple intro providers and remove unneeded ToLists (#11431)
This commit is contained in:
parent
9a515149ef
commit
d29b85a134
3 changed files with 8 additions and 5 deletions
|
@ -44,7 +44,6 @@ using MediaBrowser.Model.Library;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using TMDbLib.Objects.Authentication;
|
|
||||||
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
|
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
|
||||||
using EpisodeInfo = Emby.Naming.TV.EpisodeInfo;
|
using EpisodeInfo = Emby.Naming.TV.EpisodeInfo;
|
||||||
using Genre = MediaBrowser.Controller.Entities.Genre;
|
using Genre = MediaBrowser.Controller.Entities.Genre;
|
||||||
|
@ -1612,14 +1611,18 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <returns>IEnumerable{System.String}.</returns>
|
/// <returns>IEnumerable{System.String}.</returns>
|
||||||
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user)
|
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user)
|
||||||
{
|
{
|
||||||
|
if (IntroProviders.Length == 0)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
var tasks = IntroProviders
|
var tasks = IntroProviders
|
||||||
.Take(1)
|
|
||||||
.Select(i => GetIntros(i, item, user));
|
.Select(i => GetIntros(i, item, user));
|
||||||
|
|
||||||
var items = await Task.WhenAll(tasks).ConfigureAwait(false);
|
var items = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
return items
|
return items
|
||||||
.SelectMany(i => i.ToArray())
|
.SelectMany(i => i)
|
||||||
.Select(ResolveIntro)
|
.Select(ResolveIntro)
|
||||||
.Where(i => i is not null)!; // null values got filtered out
|
.Where(i => i is not null)!; // null values got filtered out
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
var tasks = _providers.Select(i => GetDynamicMediaSources(item, i, cancellationToken));
|
var tasks = _providers.Select(i => GetDynamicMediaSources(item, i, cancellationToken));
|
||||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
return results.SelectMany(i => i.ToList());
|
return results.SelectMany(i => i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, IMediaSourceProvider provider, CancellationToken cancellationToken)
|
private async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, IMediaSourceProvider provider, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -286,7 +286,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
|
|
||||||
return results.SelectMany(i => i.ToList());
|
return results.SelectMany(i => i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue