From 99ad70fbc81c128f5859081a3b51da8db2d78726 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Wed, 1 Apr 2026 18:01:25 +0200 Subject: [PATCH] Wrap method parameters --- Emby.Server.Implementations/Dto/DtoService.cs | 48 ++++++++++++++++--- .../Library/LibraryManager.cs | 6 ++- MediaBrowser.Controller/Dto/IDtoService.cs | 7 ++- MediaBrowser.Controller/Entities/BaseItem.cs | 8 +++- MediaBrowser.Controller/Entities/Folder.cs | 8 +++- .../Entities/UserViewBuilder.cs | 7 ++- MediaBrowser.Controller/Entities/Video.cs | 23 +++++++-- 7 files changed, 92 insertions(+), 15 deletions(-) diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 07938d172f..919733d2ad 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -153,7 +153,12 @@ namespace Emby.Server.Implementations.Dto private ILiveTvManager LivetvManager => _livetvManagerFactory.Value; /// - public IReadOnlyList GetBaseItemDtos(IReadOnlyList items, DtoOptions options, User? user = null, BaseItem? owner = null, bool skipVisibilityCheck = false) + public IReadOnlyList GetBaseItemDtos( + IReadOnlyList items, + DtoOptions options, + User? user = null, + BaseItem? owner = null, + bool skipVisibilityCheck = false) { var accessibleItems = skipVisibilityCheck || user is null ? items : items.Where(x => x.IsVisible(user)).ToList(); var returnItems = new BaseItemDto[accessibleItems.Count]; @@ -201,7 +206,15 @@ namespace Emby.Server.Implementations.Dto for (int index = 0; index < accessibleItems.Count; index++) { var item = accessibleItems[index]; - var dto = GetBaseItemDtoInternal(item, options, user, owner, userDataBatch?.GetValueOrDefault(item.Id), allCollectionFolders, childCountBatch, playedCountBatch); + var dto = GetBaseItemDtoInternal( + item, + options, + user, + owner, + userDataBatch?.GetValueOrDefault(item.Id), + allCollectionFolders, + childCountBatch, + playedCountBatch); if (item is LiveTvChannel tvChannel) { @@ -253,7 +266,15 @@ namespace Emby.Server.Implementations.Dto return dto; } - private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User? user = null, BaseItem? owner = null, UserItemData? userData = null, List? allCollectionFolders = null, Dictionary? childCountBatch = null, Dictionary? playedCountBatch = null) + private BaseItemDto GetBaseItemDtoInternal( + BaseItem item, + DtoOptions options, + User? user = null, + BaseItem? owner = null, + UserItemData? userData = null, + List? allCollectionFolders = null, + Dictionary? childCountBatch = null, + Dictionary? playedCountBatch = null) { var dto = new BaseItemDto { @@ -290,7 +311,14 @@ namespace Emby.Server.Implementations.Dto if (user is not null) { - AttachUserSpecificInfo(dto, item, user, options, userData, childCountBatch, playedCountBatch); + AttachUserSpecificInfo( + dto, + item, + user, + options, + userData, + childCountBatch, + playedCountBatch); } if (item is IHasMediaSources @@ -468,7 +496,14 @@ namespace Emby.Server.Implementations.Dto /// /// Attaches the user specific info. /// - private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, DtoOptions options, UserItemData? userData = null, Dictionary? childCountBatch = null, Dictionary? playedCountBatch = null) + private void AttachUserSpecificInfo( + BaseItemDto dto, + BaseItem item, + User user, + DtoOptions options, + UserItemData? userData = null, + Dictionary? childCountBatch = null, + Dictionary? playedCountBatch = null) { if (item.IsFolder) { @@ -480,7 +515,8 @@ namespace Emby.Server.Implementations.Dto { // Use pre-fetched user data dto.UserData = GetUserItemDataDto(userData, item.Id); - (int Played, int Total)? precomputed = playedCountBatch is not null && playedCountBatch.TryGetValue(item.Id, out var counts) ? counts : null; + (int Played, int Total)? precomputed = playedCountBatch is not null + && playedCountBatch.TryGetValue(item.Id, out var counts) ? counts : null; item.FillUserDataDtoValues(dto.UserData, userData, dto, user, options, precomputed); } else diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 57db845cb2..5d24bffa2f 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -774,7 +774,11 @@ namespace Emby.Server.Implementations.Library return key.GetMD5(); } - public BaseItem? ResolvePath(FileSystemMetadata fileInfo, Folder? parent = null, IDirectoryService? directoryService = null, CollectionType? collectionType = null) + public BaseItem? ResolvePath( + FileSystemMetadata fileInfo, + Folder? parent = null, + IDirectoryService? directoryService = null, + CollectionType? collectionType = null) => ResolvePath(fileInfo, directoryService ?? new DirectoryService(_fileSystem), null, parent, collectionType); /// diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs index 8dc6f0aa68..f735abb09f 100644 --- a/MediaBrowser.Controller/Dto/IDtoService.cs +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -38,7 +38,12 @@ namespace MediaBrowser.Controller.Dto /// The owner. /// Skip redundant visibility check if items are already filtered. /// The of . - IReadOnlyList GetBaseItemDtos(IReadOnlyList items, DtoOptions options, User? user = null, BaseItem? owner = null, bool skipVisibilityCheck = false); + IReadOnlyList GetBaseItemDtos( + IReadOnlyList items, + DtoOptions options, + User? user = null, + BaseItem? owner = null, + bool skipVisibilityCheck = false); /// /// Gets the item by name dto. diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index d963ba53f7..30e26470d6 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -2477,7 +2477,13 @@ namespace MediaBrowser.Controller.Entities return path; } - public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields, (int Played, int Total)? precomputedCounts = null) + public virtual void FillUserDataDtoValues( + UserItemDataDto dto, + UserItemData userData, + BaseItemDto itemDto, + User user, + DtoOptions fields, + (int Played, int Total)? precomputedCounts = null) { if (RunTimeTicks.HasValue) { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index fbb18afa9e..3b20dc85fe 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1859,7 +1859,13 @@ namespace MediaBrowser.Controller.Entities return !IsPlayed(user, userItemData); } - public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields, (int Played, int Total)? precomputedCounts = null) + public override void FillUserDataDtoValues( + UserItemDataDto dto, + UserItemData userData, + BaseItemDto itemDto, + User user, + DtoOptions fields, + (int Played, int Total)? precomputedCounts = null) { if (!SupportsUserDataFromChildren) { diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 77bdf402e4..cb05056601 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -493,7 +493,12 @@ namespace MediaBrowser.Controller.Entities itemsArray); } - private static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager) + private static bool Filter( + BaseItem item, + User user, + InternalItemsQuery query, + IUserDataManager userDataManager, + ILibraryManager libraryManager) { if (!string.IsNullOrEmpty(query.NameStartsWith) && !item.SortName.StartsWith(query.NameStartsWith, StringComparison.InvariantCultureIgnoreCase)) { diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 58dd3b8745..80bcd62dcd 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -461,7 +461,11 @@ namespace MediaBrowser.Controller.Entities return hasChanges; } - private async Task RefreshMetadataForVersions(MetadataRefreshOptions options, bool copyTitleMetadata, string path, CancellationToken cancellationToken) + private async Task RefreshMetadataForVersions( + MetadataRefreshOptions options, + bool copyTitleMetadata, + string path, + CancellationToken cancellationToken) { // Ensure the alternate version exists with the correct type (e.g. Movie, not Video) // before refreshing. This must happen here rather than in RefreshMetadataForOwnedVideo @@ -498,10 +502,19 @@ namespace MediaBrowser.Controller.Entities } } - private new Task RefreshMetadataForOwnedVideo(MetadataRefreshOptions options, bool copyTitleMetadata, string path, CancellationToken cancellationToken) + private new Task RefreshMetadataForOwnedVideo( + MetadataRefreshOptions options, + bool copyTitleMetadata, + string path, + CancellationToken cancellationToken) => RefreshMetadataForOwnedVideo(options, copyTitleMetadata, path, GetType(), cancellationToken); - private async Task RefreshMetadataForOwnedVideo(MetadataRefreshOptions options, bool copyTitleMetadata, string path, Type itemType, CancellationToken cancellationToken) + private async Task RefreshMetadataForOwnedVideo( + MetadataRefreshOptions options, + bool copyTitleMetadata, + string path, + Type itemType, + CancellationToken cancellationToken) { var newOptions = new MetadataRefreshOptions(options) { @@ -624,7 +637,9 @@ namespace MediaBrowser.Controller.Entities (this, MediaSourceType.Default) }; - list.AddRange(LibraryManager.GetLinkedAlternateVersions(this).Select(i => ((BaseItem)i, MediaSourceType.Grouping))); + list.AddRange( + LibraryManager.GetLinkedAlternateVersions(this) + .Select(i => ((BaseItem)i, MediaSourceType.Grouping))); if (PrimaryVersionId.HasValue) {