aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2023-10-11 11:05:14 -0400
committerPatrick Barron <barronpm@gmail.com>2023-10-11 11:05:14 -0400
commiteffc3d488c2e0df04189b18b8e47905b1f641f24 (patch)
treece6c103ec7b3b20f38e090f9d48136f4d3c89c92
parent2b1454530b2a29db2769c3de4c025d457200303f (diff)
Use DI for ContentDirectoryService
-rw-r--r--Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs2
-rw-r--r--Emby.Dlna/Main/DlnaEntryPoint.cs23
-rw-r--r--Jellyfin.Api/Controllers/DlnaServerController.cs5
3 files changed, 6 insertions, 24 deletions
diff --git a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs
index 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 DlnaServiceCollectionExtensions
services.AddSingleton<IDlnaManager, DlnaManager>();
services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>();
+ services.AddSingleton<IContentDirectory, ContentDirectoryService>();
}
}
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index 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.Main
IDeviceDiscovery 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.cs
index 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;
}