Merge pull request #8618 from jgriff6/remove-tolists

This commit is contained in:
Bond-009 2022-10-30 14:19:07 +01:00 committed by GitHub
commit 4c61bf1bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 34 deletions

View File

@ -127,8 +127,7 @@ namespace Emby.Dlna.Eventing
public Task TriggerEvent(string notificationType, IDictionary<string, string> stateVariables) public Task TriggerEvent(string notificationType, IDictionary<string, string> stateVariables)
{ {
var subs = _subscriptions.Values var subs = _subscriptions.Values
.Where(i => !i.IsExpired && string.Equals(notificationType, i.NotificationType, StringComparison.OrdinalIgnoreCase)) .Where(i => !i.IsExpired && string.Equals(notificationType, i.NotificationType, StringComparison.OrdinalIgnoreCase));
.ToList();
var tasks = subs.Select(i => TriggerEvent(i, stateVariables)); var tasks = subs.Select(i => TriggerEvent(i, stateVariables));

View File

@ -36,8 +36,7 @@ namespace Emby.Naming.AudioBook
// File with empty fullname will be sorted out here. // File with empty fullname will be sorted out here.
var audiobookFileInfos = files var audiobookFileInfos = files
.Select(i => _audioBookResolver.Resolve(i.FullName)) .Select(i => _audioBookResolver.Resolve(i.FullName))
.OfType<AudioBookFileInfo>() .OfType<AudioBookFileInfo>();
.ToList();
var stackResult = StackResolver.ResolveAudioBooks(audiobookFileInfos); var stackResult = StackResolver.ResolveAudioBooks(audiobookFileInfos);

View File

@ -88,8 +88,7 @@ namespace Emby.Notifications
string description, string description,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
users = users.Where(i => IsEnabledForUser(service, i)) users = users.Where(i => IsEnabledForUser(service, i));
.ToList();
var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken)); var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken));

View File

@ -232,10 +232,10 @@ namespace Emby.Server.Implementations.Collections
if (list.Count > 0) if (list.Count > 0)
{ {
var newList = collection.LinkedChildren.ToList(); LinkedChild[] newChildren = new LinkedChild[collection.LinkedChildren.Length + list.Count];
newList.AddRange(list); collection.LinkedChildren.CopyTo(newChildren, 0);
collection.LinkedChildren = newList.ToArray(); list.CopyTo(newChildren, collection.LinkedChildren.Length);
collection.LinkedChildren = newChildren;
collection.UpdateRatingToItems(linkedChildrenList); collection.UpdateRatingToItems(linkedChildrenList);
await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); await collection.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);

View File

@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.EntryPoints
{ {
} }
var collectionFolders = _libraryManager.GetCollectionFolders(item).ToList(); var collectionFolders = _libraryManager.GetCollectionFolders(item);
foreach (var collectionFolder in collectionFolders) foreach (var collectionFolder in collectionFolders)
{ {

View File

@ -79,14 +79,6 @@ namespace Emby.Server.Implementations.IO
TemporarilyIgnore(path); TemporarilyIgnore(path);
} }
public bool IsPathLocked(string path)
{
// This method is not used by the core but it used by auto-organize
var lockedPaths = _tempIgnoredPaths.Keys.ToList();
return lockedPaths.Any(i => _fileSystem.AreEqual(i, path) || _fileSystem.ContainsSubPath(i, path));
}
public async void ReportFileSystemChangeComplete(string path, bool refreshPath) public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
@ -145,8 +137,7 @@ namespace Emby.Server.Implementations.IO
.OfType<Folder>() .OfType<Folder>()
.SelectMany(f => f.PhysicalLocations) .SelectMany(f => f.PhysicalLocations)
.Distinct(StringComparer.OrdinalIgnoreCase) .Distinct(StringComparer.OrdinalIgnoreCase)
.OrderBy(i => i) .OrderBy(i => i);
.ToList();
foreach (var path in paths) foreach (var path in paths)
{ {
@ -372,11 +363,8 @@ namespace Emby.Server.Implementations.IO
var monitorPath = !IgnorePatterns.ShouldIgnore(path); var monitorPath = !IgnorePatterns.ShouldIgnore(path);
// Ignore certain files // Ignore certain files, If the parent of an ignored path has a change event, ignore that too
var tempIgnorePaths = _tempIgnoredPaths.Keys.ToList(); if (_tempIgnoredPaths.Keys.Any(i =>
// If the parent of an ignored path has a change event, ignore that too
if (tempIgnorePaths.Any(i =>
{ {
if (_fileSystem.AreEqual(i, path)) if (_fileSystem.AreEqual(i, path))
{ {
@ -491,7 +479,7 @@ namespace Emby.Server.Implementations.IO
{ {
lock (_activeRefreshers) lock (_activeRefreshers)
{ {
foreach (var refresher in _activeRefreshers.ToList()) foreach (var refresher in _activeRefreshers)
{ {
refresher.Completed -= OnNewRefresherCompleted; refresher.Completed -= OnNewRefresherCompleted;
refresher.Dispose(); refresher.Dispose();

View File

@ -34,12 +34,5 @@ namespace MediaBrowser.Controller.Library
/// </summary> /// </summary>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
void ReportFileSystemChanged(string path); void ReportFileSystemChanged(string path);
/// <summary>
/// Determines whether [is path locked] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is path locked] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsPathLocked(string path);
} }
} }