Fix a few multiple enumerations

This commit is contained in:
Stepan Goremykin 2023-08-26 16:57:27 +02:00
parent 3ee1141a06
commit 0ed2aa6f06
2 changed files with 5 additions and 7 deletions

View File

@ -358,7 +358,7 @@ namespace Emby.Server.Implementations.Library
var children = item.IsFolder
? ((Folder)item).GetRecursiveChildren(false)
: Enumerable.Empty<BaseItem>();
: Array.Empty<BaseItem>();
foreach (var metadataPath in GetMetadataPaths(item, children))
{

View File

@ -807,13 +807,11 @@ namespace MediaBrowser.Providers.Manager
where TLookupType : ItemLookupInfo
{
var results = await provider.GetSearchResults(searchInfo, cancellationToken).ConfigureAwait(false);
foreach (var item in results)
return results.Select(result =>
{
item.SearchProviderName = provider.Name;
}
return results;
result.SearchProviderName = provider.Name;
return result;
});
}
private IEnumerable<IExternalId> GetExternalIds(IHasProviderIds item)