Browse Source

Register ILiveTvManager and IPlaylistManager correctly

Mark Monteiro 5 years ago
parent
commit
3d5b4f869c

+ 3 - 3
Emby.Server.Implementations/ApplicationHost.cs

@@ -797,10 +797,9 @@ namespace Emby.Server.Implementations
             CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory, ProviderManager);
             serviceCollection.AddSingleton(CollectionManager);
 
-            serviceCollection.AddSingleton(typeof(IPlaylistManager), typeof(PlaylistManager));
+            serviceCollection.AddSingleton<IPlaylistManager, PlaylistManager>();
 
-            LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, FileSystemManager, () => ChannelManager);
-            serviceCollection.AddSingleton(LiveTvManager);
+            serviceCollection.AddSingleton<ILiveTvManager, LiveTvManager>();
 
             serviceCollection.AddSingleton<IUserViewManager, UserViewManager>();
 
@@ -833,6 +832,7 @@ namespace Emby.Server.Implementations
         /// </summary>
         public void InitializeServices()
         {
+            LiveTvManager = Resolve<ILiveTvManager>();
             NotificationManager = Resolve<INotificationManager>();
             HttpServer = Resolve<IHttpServer>();
 

+ 3 - 3
Emby.Server.Implementations/LiveTv/LiveTvManager.cs

@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv
         private readonly ILibraryManager _libraryManager;
         private readonly ITaskManager _taskManager;
         private readonly IJsonSerializer _jsonSerializer;
-        private readonly Func<IChannelManager> _channelManager;
+        private readonly IChannelManager _channelManager;
 
         private readonly IDtoService _dtoService;
         private readonly ILocalizationManager _localization;
@@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.LiveTv
             ILocalizationManager localization,
             IJsonSerializer jsonSerializer,
             IFileSystem fileSystem,
-            Func<IChannelManager> channelManager)
+            IChannelManager channelManager)
         {
             _config = config;
             _logger = loggerFactory.CreateLogger(nameof(LiveTvManager));
@@ -2482,7 +2482,7 @@ namespace Emby.Server.Implementations.LiveTv
                 .OrderBy(i => i.SortName)
                 .ToList();
 
-            folders.AddRange(_channelManager().GetChannelsInternal(new MediaBrowser.Model.Channels.ChannelQuery
+            folders.AddRange(_channelManager.GetChannelsInternal(new MediaBrowser.Model.Channels.ChannelQuery
             {
                 UserId = user.Id,
                 IsRecordingsFolder = true,