mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 04:48:27 +01:00
More efficient array creation (#11468)
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
};
|
||||
|
||||
private static readonly Glob[] _globs = _patterns.Select(p => Glob.Parse(p, _globOptions)).ToArray();
|
||||
private static readonly Glob[] _globs = Array.ConvertAll(_patterns, p => Glob.Parse(p, _globOptions));
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the supplied path should be ignored.
|
||||
|
||||
@@ -3038,9 +3038,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
|
||||
|
||||
var list = libraryOptions.PathInfos.ToList();
|
||||
list.Add(pathInfo);
|
||||
libraryOptions.PathInfos = list.ToArray();
|
||||
libraryOptions.PathInfos = [..libraryOptions.PathInfos, pathInfo];
|
||||
|
||||
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
|
||||
|
||||
@@ -3059,8 +3057,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
SyncLibraryOptionsToLocations(virtualFolderPath, libraryOptions);
|
||||
|
||||
var list = libraryOptions.PathInfos.ToList();
|
||||
foreach (var originalPathInfo in list)
|
||||
foreach (var originalPathInfo in libraryOptions.PathInfos)
|
||||
{
|
||||
if (string.Equals(mediaPath.Path, originalPathInfo.Path, StringComparison.Ordinal))
|
||||
{
|
||||
@@ -3069,8 +3066,6 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
libraryOptions.PathInfos = list.ToArray();
|
||||
|
||||
CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,8 +303,8 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
// Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
|
||||
// Thanks to mixed content libraries included in the UserView
|
||||
var hasCollectionType = parents.OfType<UserView>().ToArray();
|
||||
if (hasCollectionType.Length > 0)
|
||||
var hasCollectionType = parents.OfType<UserView>().ToList();
|
||||
if (hasCollectionType.Count > 0)
|
||||
{
|
||||
if (hasCollectionType.All(i => i.CollectionType == CollectionType.movies))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user