Use DI for ContentDirectoryService

This commit is contained in:
Patrick Barron 2023-10-11 11:05:14 -04:00
parent 2b1454530b
commit effc3d488c
3 changed files with 6 additions and 24 deletions

View File

@ -3,6 +3,7 @@ using System.Globalization;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using Emby.Dlna.ContentDirectory;
using Emby.Dlna.Ssdp; using Emby.Dlna.Ssdp;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
@ -48,5 +49,6 @@ public static class DlnaServiceCollectionExtensions
services.AddSingleton<IDlnaManager, DlnaManager>(); services.AddSingleton<IDlnaManager, DlnaManager>();
services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>(); services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>();
services.AddSingleton<IContentDirectory, ContentDirectoryService>();
} }
} }

View File

@ -23,7 +23,6 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
@ -76,9 +75,7 @@ namespace Emby.Dlna.Main
IDeviceDiscovery deviceDiscovery, IDeviceDiscovery deviceDiscovery,
IMediaEncoder mediaEncoder, IMediaEncoder mediaEncoder,
ISocketFactory socketFactory, ISocketFactory socketFactory,
INetworkManager networkManager, INetworkManager networkManager)
IUserViewManager userViewManager,
ITVSeriesManager tvSeriesManager)
{ {
_config = config; _config = config;
_appHost = appHost; _appHost = appHost;
@ -97,21 +94,6 @@ namespace Emby.Dlna.Main
_networkManager = networkManager; _networkManager = networkManager;
_logger = loggerFactory.CreateLogger<DlnaEntryPoint>(); _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( ConnectionManager = new ConnectionManager.ConnectionManagerService(
dlnaManager, dlnaManager,
config, config,
@ -140,8 +122,6 @@ namespace Emby.Dlna.Main
/// </summary> /// </summary>
public static bool Enabled { get; private set; } public static bool Enabled { get; private set; }
public IContentDirectory ContentDirectory { get; private set; }
public IConnectionManager ConnectionManager { get; private set; } public IConnectionManager ConnectionManager { get; private set; }
public IMediaReceiverRegistrar MediaReceiverRegistrar { get; private set; } public IMediaReceiverRegistrar MediaReceiverRegistrar { get; private set; }
@ -453,7 +433,6 @@ namespace Emby.Dlna.Main
_communicationsServer = null; _communicationsServer = null;
} }
ContentDirectory = null;
ConnectionManager = null; ConnectionManager = null;
MediaReceiverRegistrar = null; MediaReceiverRegistrar = null;
Current = null; Current = null;

View File

@ -33,10 +33,11 @@ public class DlnaServerController : BaseJellyfinApiController
/// Initializes a new instance of the <see cref="DlnaServerController"/> class. /// Initializes a new instance of the <see cref="DlnaServerController"/> class.
/// </summary> /// </summary>
/// <param name="dlnaManager">Instance of the <see cref="IDlnaManager"/> interface.</param> /// <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; _dlnaManager = dlnaManager;
_contentDirectory = DlnaEntryPoint.Current.ContentDirectory; _contentDirectory = contentDirectory;
_connectionManager = DlnaEntryPoint.Current.ConnectionManager; _connectionManager = DlnaEntryPoint.Current.ConnectionManager;
_mediaReceiverRegistrar = DlnaEntryPoint.Current.MediaReceiverRegistrar; _mediaReceiverRegistrar = DlnaEntryPoint.Current.MediaReceiverRegistrar;
} }