mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #10154 from goremykin/multiple-enumerations
This commit is contained in:
commit
3b07d73d40
@ -358,7 +358,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
var children = item.IsFolder
|
var children = item.IsFolder
|
||||||
? ((Folder)item).GetRecursiveChildren(false)
|
? ((Folder)item).GetRecursiveChildren(false)
|
||||||
: Enumerable.Empty<BaseItem>();
|
: Array.Empty<BaseItem>();
|
||||||
|
|
||||||
foreach (var metadataPath in GetMetadataPaths(item, children))
|
foreach (var metadataPath in GetMetadataPaths(item, children))
|
||||||
{
|
{
|
||||||
|
@ -765,10 +765,12 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var results = await GetSearchResults(provider, searchInfo.SearchInfo, cancellationToken).ConfigureAwait(false);
|
var results = await provider.GetSearchResults(searchInfo.SearchInfo, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var result in results)
|
foreach (var result in results)
|
||||||
{
|
{
|
||||||
|
result.SearchProviderName = provider.Name;
|
||||||
|
|
||||||
var existingMatch = resultList.FirstOrDefault(i => i.ProviderIds.Any(p => string.Equals(result.GetProviderId(p.Key), p.Value, StringComparison.OrdinalIgnoreCase)));
|
var existingMatch = resultList.FirstOrDefault(i => i.ProviderIds.Any(p => string.Equals(result.GetProviderId(p.Key), p.Value, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
if (existingMatch is null)
|
if (existingMatch is null)
|
||||||
@ -800,22 +802,6 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<RemoteSearchResult>> GetSearchResults<TLookupType>(
|
|
||||||
IRemoteSearchProvider<TLookupType> provider,
|
|
||||||
TLookupType searchInfo,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
where TLookupType : ItemLookupInfo
|
|
||||||
{
|
|
||||||
var results = await provider.GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
|
|
||||||
|
|
||||||
foreach (var item in results)
|
|
||||||
{
|
|
||||||
item.SearchProviderName = provider.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IExternalId> GetExternalIds(IHasProviderIds item)
|
private IEnumerable<IExternalId> GetExternalIds(IHasProviderIds item)
|
||||||
{
|
{
|
||||||
return _externalIds.Where(i =>
|
return _externalIds.Where(i =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user