The Free Software Media System - Server Backend & API
Use DI for ContentDirectoryService
Patrick Barroneffc3d488c2e
diff --git a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.csindex 3a47acf10a..c28a5618ce 100644--- a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs+++ b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs@@ -3,6 +3,7 @@ using System.Globalization;using System.Net;using System.Net.Http;using System.Text;+using Emby.Dlna.ContentDirectory;using Emby.Dlna.Ssdp;using MediaBrowser.Common.Net;using MediaBrowser.Controller;@@ -48,5 +49,6 @@ public static class DlnaServiceCollectionExtensionsservices.AddSingleton<IDlnaManager, DlnaManager>();services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>();+ services.AddSingleton<IContentDirectory, ContentDirectoryService>();}}diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.csindex 83b0ef3164..b2d2f36986 100644--- a/Emby.Dlna/Main/DlnaEntryPoint.cs+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs@@ -23,7 +23,6 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Controller.Plugins;using MediaBrowser.Controller.Session;-using MediaBrowser.Controller.TV;using MediaBrowser.Model.Dlna;using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Net;@@ -76,9 +75,7 @@ namespace Emby.Dlna.MainIDeviceDiscovery deviceDiscovery,IMediaEncoder mediaEncoder,ISocketFactory socketFactory,- INetworkManager networkManager,- IUserViewManager userViewManager,- ITVSeriesManager tvSeriesManager)+ INetworkManager networkManager){_config = config;_appHost = appHost;@@ -97,21 +94,6 @@ namespace Emby.Dlna.Main_networkManager = networkManager;_logger = loggerFactory.CreateLogger<DlnaEntryPoint>();- ContentDirectory = new ContentDirectory.ContentDirectoryService(- dlnaManager,- userDataManager,- imageProcessor,- libraryManager,- config,- userManager,- loggerFactory.CreateLogger<ContentDirectory.ContentDirectoryService>(),- httpClientFactory,- localizationManager,- mediaSourceManager,- userViewManager,- mediaEncoder,- tvSeriesManager);-ConnectionManager = new ConnectionManager.ConnectionManagerService(dlnaManager,config,@@ -140,8 +122,6 @@ namespace Emby.Dlna.Main/// </summary>public static bool Enabled { get; private set; }- public IContentDirectory ContentDirectory { get; private set; }-public IConnectionManager ConnectionManager { get; private set; }public IMediaReceiverRegistrar MediaReceiverRegistrar { get; private set; }@@ -453,7 +433,6 @@ namespace Emby.Dlna.Main_communicationsServer = null;}- ContentDirectory = null;ConnectionManager = null;MediaReceiverRegistrar = null;Current = null;diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.csindex 95b296fae9..178ba6d6e1 100644--- a/Jellyfin.Api/Controllers/DlnaServerController.cs+++ b/Jellyfin.Api/Controllers/DlnaServerController.cs@@ -33,10 +33,11 @@ public class DlnaServerController : BaseJellyfinApiController/// Initializes a new instance of the <see cref="DlnaServerController"/> class./// </summary>/// <param name="dlnaManager">Instance of the <see cref="IDlnaManager"/> interface.</param>- public DlnaServerController(IDlnaManager dlnaManager)+ /// <param name="contentDirectory">Instance of the <see cref="IContentDirectory"/> interface.</param>+ public DlnaServerController(IDlnaManager dlnaManager, IContentDirectory contentDirectory){_dlnaManager = dlnaManager;- _contentDirectory = DlnaEntryPoint.Current.ContentDirectory;+ _contentDirectory = contentDirectory;_connectionManager = DlnaEntryPoint.Current.ConnectionManager;_mediaReceiverRegistrar = DlnaEntryPoint.Current.MediaReceiverRegistrar;}