mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-17 15:53:42 +01: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:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -28,13 +29,17 @@ namespace MediaBrowser.Controller.Entities
|
||||
Url = url
|
||||
};
|
||||
|
||||
if (item.RemoteTrailers.Length == 0)
|
||||
if (item.RemoteTrailers.Count == 0)
|
||||
{
|
||||
item.RemoteTrailers = new[] { mediaUrl };
|
||||
}
|
||||
else
|
||||
{
|
||||
item.RemoteTrailers = item.RemoteTrailers.Concat(new[] { mediaUrl }).ToArray();
|
||||
var oldIds = item.RemoteTrailers;
|
||||
var newIds = new MediaUrl[oldIds.Count + 1];
|
||||
oldIds.CopyTo(newIds);
|
||||
newIds[oldIds.Count] = mediaUrl;
|
||||
item.RemoteTrailers = newIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user