mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Fix warnings, improve performance (#1665)
* Fix warnings, improve performance `QueryResult.Items` is now a `IReadOnlyList` so we don't need to allocate a new `Array` when we have a `List` (and `Items` shouldn't need to be mutable anyway) * Update Providers .csproj to latest C# * Remove extra newline from DtoService.cs * Remove extra newline from UserLibraryService.cs
This commit is contained in:
@@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<BaseItem> GetItemsForLatestItems(User user, LatestItemsQuery request, DtoOptions options)
|
||||
private IReadOnlyList<BaseItem> GetItemsForLatestItems(User user, LatestItemsQuery request, DtoOptions options)
|
||||
{
|
||||
var parentId = request.ParentId;
|
||||
|
||||
@@ -236,24 +236,22 @@ namespace Emby.Server.Implementations.Library
|
||||
if (!parentId.Equals(Guid.Empty))
|
||||
{
|
||||
var parentItem = _libraryManager.GetItemById(parentId);
|
||||
var parentItemChannel = parentItem as Channel;
|
||||
if (parentItemChannel != null)
|
||||
if (parentItem is Channel parentItemChannel)
|
||||
{
|
||||
return _channelManager.GetLatestChannelItemsInternal(new InternalItemsQuery(user)
|
||||
{
|
||||
ChannelIds = new[] { parentId },
|
||||
IsPlayed = request.IsPlayed,
|
||||
StartIndex = request.StartIndex,
|
||||
Limit = request.Limit,
|
||||
IncludeItemTypes = request.IncludeItemTypes,
|
||||
EnableTotalRecordCount = false
|
||||
|
||||
|
||||
}, CancellationToken.None).Result.Items.ToList();
|
||||
return _channelManager.GetLatestChannelItemsInternal(
|
||||
new InternalItemsQuery(user)
|
||||
{
|
||||
ChannelIds = new[] { parentId },
|
||||
IsPlayed = request.IsPlayed,
|
||||
StartIndex = request.StartIndex,
|
||||
Limit = request.Limit,
|
||||
IncludeItemTypes = request.IncludeItemTypes,
|
||||
EnableTotalRecordCount = false
|
||||
},
|
||||
CancellationToken.None).Result.Items;
|
||||
}
|
||||
|
||||
var parent = parentItem as Folder;
|
||||
if (parent != null)
|
||||
if (parentItem is Folder parent)
|
||||
{
|
||||
parents.Add(parent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user