diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 66bd68ddd0..9fa4d3599f 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -537,7 +537,7 @@ namespace Emby.Server.Implementations.Library collectionType = GetContentTypeOverride(fullPath, true); } - var args = new ItemResolveArgs(_configurationManager.ApplicationPaths, directoryService) + var args = new ItemResolveArgs(_configurationManager.ApplicationPaths, directoryService, this) { Parent = parent, FileInfo = fileInfo, diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 08c622cde0..aacb38607e 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -120,7 +120,7 @@ namespace MediaBrowser.Controller.Entities var path = ContainingFolderPath; - var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService) + var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService, LibraryManager) { FileInfo = FileSystem.GetDirectoryInfo(path) }; diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 5ac619d8f5..ff17797179 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -288,7 +288,7 @@ namespace MediaBrowser.Controller.Entities { var path = ContainingFolderPath; - var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService) + var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService, LibraryManager) { FileInfo = FileSystem.GetDirectoryInfo(path), Parent = GetParent() as Folder, diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 01986d3032..730d89356d 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -23,6 +23,7 @@ namespace MediaBrowser.Controller.Library /// private readonly IServerApplicationPaths _appPaths; + private readonly ILibraryManager _libraryManager; private LibraryOptions _libraryOptions; /// @@ -30,10 +31,12 @@ namespace MediaBrowser.Controller.Library /// /// The app paths. /// The directory service. - public ItemResolveArgs(IServerApplicationPaths appPaths, IDirectoryService directoryService) + /// The library manager. + public ItemResolveArgs(IServerApplicationPaths appPaths, IDirectoryService directoryService, ILibraryManager libraryManager) { _appPaths = appPaths; DirectoryService = directoryService; + _libraryManager = libraryManager; } // TODO remove dependencies as properties, they should be injected where it makes sense @@ -47,7 +50,7 @@ namespace MediaBrowser.Controller.Library public LibraryOptions LibraryOptions { - get => _libraryOptions ??= Parent is null ? new LibraryOptions() : BaseItem.LibraryManager.GetLibraryOptions(Parent); + get => _libraryOptions ??= Parent is null ? new LibraryOptions() : _libraryManager.GetLibraryOptions(Parent); set => _libraryOptions = value; } @@ -231,21 +234,15 @@ namespace MediaBrowser.Controller.Library /// /// Gets the configured content type for the path. /// - /// - /// This is subject to future refactoring as it relies on a static property in BaseItem. - /// /// The configured content type. public string GetConfiguredContentType() { - return BaseItem.LibraryManager.GetConfiguredContentType(Path); + return _libraryManager.GetConfiguredContentType(Path); } /// /// Gets the file system children that do not hit the ignore file check. /// - /// - /// This is subject to future refactoring as it relies on a static property in BaseItem. - /// /// The file system children that are not ignored. public IEnumerable GetActualFileSystemChildren() { @@ -253,7 +250,7 @@ namespace MediaBrowser.Controller.Library for (var i = 0; i < numberOfChildren; i++) { var child = FileSystemChildren[i]; - if (BaseItem.LibraryManager.IgnoreFile(child, Parent)) + if (_libraryManager.IgnoreFile(child, Parent)) { continue; } diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/EpisodeResolverTest.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/EpisodeResolverTest.cs index 286ba04059..65f19a051a 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Library/EpisodeResolverTest.cs +++ b/tests/Jellyfin.Server.Implementations.Tests/Library/EpisodeResolverTest.cs @@ -25,7 +25,8 @@ namespace Jellyfin.Server.Implementations.Tests.Library var episodeResolver = new EpisodeResolver(Mock.Of>(), _namingOptions); var itemResolveArgs = new ItemResolveArgs( Mock.Of(), - Mock.Of()) + Mock.Of(), + null) { Parent = parent, CollectionType = CollectionType.TvShows, @@ -48,7 +49,8 @@ namespace Jellyfin.Server.Implementations.Tests.Library var episodeResolver = new EpisodeResolverMock(Mock.Of>(), _namingOptions); var itemResolveArgs = new ItemResolveArgs( Mock.Of(), - Mock.Of()) + Mock.Of(), + null) { Parent = series, CollectionType = CollectionType.TvShows, diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/MovieResolverTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/MovieResolverTests.cs index efc3ac0c2a..f96bd6138e 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Library/MovieResolverTests.cs +++ b/tests/Jellyfin.Server.Implementations.Tests/Library/MovieResolverTests.cs @@ -21,7 +21,8 @@ public class MovieResolverTests var movieResolver = new MovieResolver(Mock.Of(), Mock.Of>(), _namingOptions); var itemResolveArgs = new ItemResolveArgs( Mock.Of(), - Mock.Of()) + Mock.Of(), + null) { Parent = null, FileInfo = new FileSystemMetadata