Break up long lines

This commit is contained in:
Patrick Barron 2023-11-15 16:35:01 -05:00
parent 98f8cb2ad0
commit eb4d8e13df

View File

@ -296,7 +296,13 @@ namespace Emby.Server.Implementations.EntryPoints
/// <param name="foldersAddedTo">The folders added to.</param> /// <param name="foldersAddedTo">The folders added to.</param>
/// <param name="foldersRemovedFrom">The folders removed from.</param> /// <param name="foldersRemovedFrom">The folders removed from.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
private async Task SendChangeNotifications(List<BaseItem> itemsAdded, List<BaseItem> itemsUpdated, List<BaseItem> itemsRemoved, List<Folder> foldersAddedTo, List<Folder> foldersRemovedFrom, CancellationToken cancellationToken) private async Task SendChangeNotifications(
List<BaseItem> itemsAdded,
List<BaseItem> itemsUpdated,
List<BaseItem> itemsRemoved,
List<Folder> foldersAddedTo,
List<Folder> foldersRemovedFrom,
CancellationToken cancellationToken)
{ {
var userIds = _sessionManager.Sessions var userIds = _sessionManager.Sessions
.Select(i => i.UserId) .Select(i => i.UserId)
@ -325,7 +331,12 @@ namespace Emby.Server.Implementations.EntryPoints
try try
{ {
await _sessionManager.SendMessageToUserSessions(new List<Guid> { userId }, SessionMessageType.LibraryChanged, info, cancellationToken).ConfigureAwait(false); await _sessionManager.SendMessageToUserSessions(
new List<Guid> { userId },
SessionMessageType.LibraryChanged,
info,
cancellationToken)
.ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -344,7 +355,13 @@ namespace Emby.Server.Implementations.EntryPoints
/// <param name="foldersRemovedFrom">The folders removed from.</param> /// <param name="foldersRemovedFrom">The folders removed from.</param>
/// <param name="userId">The user id.</param> /// <param name="userId">The user id.</param>
/// <returns>LibraryUpdateInfo.</returns> /// <returns>LibraryUpdateInfo.</returns>
private LibraryUpdateInfo GetLibraryUpdateInfo(List<BaseItem> itemsAdded, List<BaseItem> itemsUpdated, List<BaseItem> itemsRemoved, List<Folder> foldersAddedTo, List<Folder> foldersRemovedFrom, Guid userId) private LibraryUpdateInfo GetLibraryUpdateInfo(
List<BaseItem> itemsAdded,
List<BaseItem> itemsUpdated,
List<BaseItem> itemsRemoved,
List<Folder> foldersAddedTo,
List<Folder> foldersRemovedFrom,
Guid userId)
{ {
var user = _userManager.GetUserById(userId); var user = _userManager.GetUserById(userId);
@ -352,20 +369,33 @@ namespace Emby.Server.Implementations.EntryPoints
newAndRemoved.AddRange(foldersAddedTo); newAndRemoved.AddRange(foldersAddedTo);
newAndRemoved.AddRange(foldersRemovedFrom); newAndRemoved.AddRange(foldersRemovedFrom);
var allUserRootChildren = _libraryManager.GetUserRootFolder().GetChildren(user, true).OfType<Folder>().ToList(); var allUserRootChildren = _libraryManager.GetUserRootFolder()
.GetChildren(user, true)
.OfType<Folder>()
.ToList();
return new LibraryUpdateInfo return new LibraryUpdateInfo
{ {
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(), ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user))
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(), .Distinct()
.ToArray(),
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(), ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user))
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(), .Distinct()
.ToArray(),
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(), ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true))
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
.Distinct()
.ToArray(),
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user))
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
.Distinct()
.ToArray(),
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user))
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
.Distinct()
.ToArray(),
CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray() CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray()
}; };
} }