|
|
@ -8,6 +8,7 @@ using MediaBrowser.Common.Implementations.ScheduledTasks;
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
using MediaBrowser.Common.MediaInfo;
|
|
|
|
using MediaBrowser.Common.MediaInfo;
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
|
|
|
using MediaBrowser.Common.Progress;
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Drawing;
|
|
|
|
using MediaBrowser.Controller.Drawing;
|
|
|
@ -170,8 +171,6 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
private IItemRepository ItemRepository { get; set; }
|
|
|
|
private IItemRepository ItemRepository { get; set; }
|
|
|
|
private INotificationsRepository NotificationsRepository { get; set; }
|
|
|
|
private INotificationsRepository NotificationsRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private Task<IHttpServer> _httpServerCreationTask;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="ApplicationHost"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="ApplicationHost"/> class.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -215,25 +214,15 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Called when [logger loaded].
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
protected override void OnLoggerLoaded()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
base.OnLoggerLoaded();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_httpServerCreationTask = Task.Run(() => ServerFactory.CreateServer(this, LogManager, "Media Browser", "mediabrowser", "dashboard/index.html"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Registers resources that classes will depend on
|
|
|
|
/// Registers resources that classes will depend on
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
protected override async Task RegisterResources()
|
|
|
|
protected override async Task RegisterResources(IProgress<double> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ServerKernel = new Kernel();
|
|
|
|
ServerKernel = new Kernel();
|
|
|
|
|
|
|
|
|
|
|
|
await base.RegisterResources().ConfigureAwait(false);
|
|
|
|
await base.RegisterResources(progress).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory(LogManager, FileSystemManager));
|
|
|
|
RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory(LogManager, FileSystemManager));
|
|
|
|
|
|
|
|
|
|
|
@ -247,8 +236,6 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
|
|
|
|
|
|
|
|
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
|
|
|
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
|
|
|
|
|
|
|
|
|
|
|
var mediaEncoderTask = RegisterMediaEncoder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserDataManager = new UserDataManager(LogManager);
|
|
|
|
UserDataManager = new UserDataManager(LogManager);
|
|
|
|
RegisterSingleInstance(UserDataManager);
|
|
|
|
RegisterSingleInstance(UserDataManager);
|
|
|
|
|
|
|
|
|
|
|
@ -278,8 +265,9 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
SessionManager = new SessionManager(UserDataManager, ServerConfigurationManager, Logger, UserRepository, LibraryManager);
|
|
|
|
SessionManager = new SessionManager(UserDataManager, ServerConfigurationManager, Logger, UserRepository, LibraryManager);
|
|
|
|
RegisterSingleInstance(SessionManager);
|
|
|
|
RegisterSingleInstance(SessionManager);
|
|
|
|
|
|
|
|
|
|
|
|
HttpServer = await _httpServerCreationTask.ConfigureAwait(false);
|
|
|
|
HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", "mediabrowser", "dashboard/index.html");
|
|
|
|
RegisterSingleInstance(HttpServer, false);
|
|
|
|
RegisterSingleInstance(HttpServer, false);
|
|
|
|
|
|
|
|
progress.Report(10);
|
|
|
|
|
|
|
|
|
|
|
|
ServerManager = new ServerManager(this, JsonSerializer, Logger, ServerConfigurationManager);
|
|
|
|
ServerManager = new ServerManager(this, JsonSerializer, Logger, ServerConfigurationManager);
|
|
|
|
RegisterSingleInstance(ServerManager);
|
|
|
|
RegisterSingleInstance(ServerManager);
|
|
|
@ -295,14 +283,23 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
|
|
|
|
|
|
|
|
LiveTvManager = new LiveTvManager(ApplicationPaths, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserManager, LocalizationManager, UserDataManager, DtoService);
|
|
|
|
LiveTvManager = new LiveTvManager(ApplicationPaths, FileSystemManager, Logger, ItemRepository, ImageProcessor, UserManager, LocalizationManager, UserDataManager, DtoService);
|
|
|
|
RegisterSingleInstance(LiveTvManager);
|
|
|
|
RegisterSingleInstance(LiveTvManager);
|
|
|
|
|
|
|
|
progress.Report(15);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var innerProgress = new ActionableProgress<double>();
|
|
|
|
|
|
|
|
innerProgress.RegisterAction(p => progress.Report((.75 * p) + 15));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await RegisterMediaEncoder(innerProgress).ConfigureAwait(false);
|
|
|
|
|
|
|
|
progress.Report(90);
|
|
|
|
|
|
|
|
|
|
|
|
var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false));
|
|
|
|
var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false));
|
|
|
|
var itemsTask = Task.Run(async () => await ConfigureItemRepositories().ConfigureAwait(false));
|
|
|
|
var itemsTask = Task.Run(async () => await ConfigureItemRepositories().ConfigureAwait(false));
|
|
|
|
var userdataTask = Task.Run(async () => await ConfigureUserDataRepositories().ConfigureAwait(false));
|
|
|
|
var userdataTask = Task.Run(async () => await ConfigureUserDataRepositories().ConfigureAwait(false));
|
|
|
|
|
|
|
|
|
|
|
|
await ConfigureNotificationsRepository().ConfigureAwait(false);
|
|
|
|
await ConfigureNotificationsRepository().ConfigureAwait(false);
|
|
|
|
|
|
|
|
progress.Report(92);
|
|
|
|
|
|
|
|
|
|
|
|
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask, mediaEncoderTask).ConfigureAwait(false);
|
|
|
|
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false);
|
|
|
|
|
|
|
|
progress.Report(100);
|
|
|
|
|
|
|
|
|
|
|
|
SetKernelProperties();
|
|
|
|
SetKernelProperties();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -321,9 +318,9 @@ namespace MediaBrowser.ServerApplication
|
|
|
|
/// Registers the media encoder.
|
|
|
|
/// Registers the media encoder.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
private async Task RegisterMediaEncoder()
|
|
|
|
private async Task RegisterMediaEncoder(IProgress<double> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager).GetFFMpegInfo().ConfigureAwait(false);
|
|
|
|
var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager).GetFFMpegInfo(progress).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
MediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"), ApplicationPaths, JsonSerializer, info.Path, info.ProbePath, info.Version, FileSystemManager);
|
|
|
|
MediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"), ApplicationPaths, JsonSerializer, info.Path, info.ProbePath, info.Version, FileSystemManager);
|
|
|
|
RegisterSingleInstance(MediaEncoder);
|
|
|
|
RegisterSingleInstance(MediaEncoder);
|
|
|
|