diff options
| author | Patrick Barron <barronpm@gmail.com> | 2023-10-11 11:08:19 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2023-10-11 11:08:19 -0400 |
| commit | e0b089a37573a02898e179e738d44039df9432bf (patch) | |
| tree | 156310cd1a0958e96b95687a10857c43af3bc80f | |
| parent | effc3d488c2e0df04189b18b8e47905b1f641f24 (diff) | |
Use DI for ConnectionManagerService
| -rw-r--r-- | Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs | 2 | ||||
| -rw-r--r-- | Emby.Dlna/Main/DlnaEntryPoint.cs | 9 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/DlnaServerController.cs | 8 |
3 files changed, 8 insertions, 11 deletions
diff --git a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs index c28a5618c..f8ed00aea 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.ConnectionManager; using Emby.Dlna.ContentDirectory; using Emby.Dlna.Ssdp; using MediaBrowser.Common.Net; @@ -50,5 +51,6 @@ public static class DlnaServiceCollectionExtensions services.AddSingleton<IDlnaManager, DlnaManager>(); services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>(); services.AddSingleton<IContentDirectory, ContentDirectoryService>(); + services.AddSingleton<IConnectionManager, ConnectionManagerService>(); } } diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index b2d2f3698..a22143ae7 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -94,12 +94,6 @@ namespace Emby.Dlna.Main _networkManager = networkManager; _logger = loggerFactory.CreateLogger<DlnaEntryPoint>(); - ConnectionManager = new ConnectionManager.ConnectionManagerService( - dlnaManager, - config, - loggerFactory.CreateLogger<ConnectionManager.ConnectionManagerService>(), - httpClientFactory); - MediaReceiverRegistrar = new MediaReceiverRegistrar.MediaReceiverRegistrarService( loggerFactory.CreateLogger<MediaReceiverRegistrar.MediaReceiverRegistrarService>(), httpClientFactory, @@ -122,8 +116,6 @@ namespace Emby.Dlna.Main /// </summary> public static bool Enabled { get; private set; } - public IConnectionManager ConnectionManager { get; private set; } - public IMediaReceiverRegistrar MediaReceiverRegistrar { get; private set; } public async Task RunAsync() @@ -433,7 +425,6 @@ namespace Emby.Dlna.Main _communicationsServer = null; } - ConnectionManager = null; MediaReceiverRegistrar = null; Current = null; diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.cs index 178ba6d6e..2d52097c0 100644 --- a/Jellyfin.Api/Controllers/DlnaServerController.cs +++ b/Jellyfin.Api/Controllers/DlnaServerController.cs @@ -34,11 +34,15 @@ public class DlnaServerController : BaseJellyfinApiController /// </summary> /// <param name="dlnaManager">Instance of the <see cref="IDlnaManager"/> interface.</param> /// <param name="contentDirectory">Instance of the <see cref="IContentDirectory"/> interface.</param> - public DlnaServerController(IDlnaManager dlnaManager, IContentDirectory contentDirectory) + /// <param name="connectionManager">Instance of the <see cref="IConnectionManager"/> interface.</param> + public DlnaServerController( + IDlnaManager dlnaManager, + IContentDirectory contentDirectory, + IConnectionManager connectionManager) { _dlnaManager = dlnaManager; _contentDirectory = contentDirectory; - _connectionManager = DlnaEntryPoint.Current.ConnectionManager; + _connectionManager = connectionManager; _mediaReceiverRegistrar = DlnaEntryPoint.Current.MediaReceiverRegistrar; } |
