mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
created an init method on base app host
This commit is contained in:
parent
7665b1563d
commit
7b0b5a3538
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common.Implementations.Udp;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Common.Implementations.Udp;
|
||||||
using MediaBrowser.Common.Implementations.Updates;
|
using MediaBrowser.Common.Implementations.Updates;
|
||||||
using MediaBrowser.Common.Implementations.WebSocket;
|
using MediaBrowser.Common.Implementations.WebSocket;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
@ -48,7 +49,7 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
/// The container
|
/// The container
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Container Container = new Container();
|
protected readonly Container Container = new Container();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets assemblies that failed to load
|
/// Gets assemblies that failed to load
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -114,16 +115,26 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
protected BaseApplicationHost()
|
protected BaseApplicationHost()
|
||||||
{
|
{
|
||||||
FailedAssemblies = new List<string>();
|
FailedAssemblies = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationPaths = GetApplicationPaths();
|
/// <summary>
|
||||||
|
/// Inits this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
public virtual Task Init()
|
||||||
|
{
|
||||||
|
return Task.Run(() =>
|
||||||
|
{
|
||||||
|
ApplicationPaths = GetApplicationPaths();
|
||||||
|
|
||||||
LogManager = GetLogManager();
|
LogManager = GetLogManager();
|
||||||
|
|
||||||
Logger = LogManager.GetLogger("App");
|
Logger = LogManager.GetLogger("App");
|
||||||
|
|
||||||
IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
|
IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
|
||||||
|
|
||||||
DiscoverTypes();
|
DiscoverTypes();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -157,7 +168,7 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
|
|
||||||
Plugins = GetExports<IPlugin>();
|
Plugins = GetExports<IPlugin>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Discovers the types.
|
/// Discovers the types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -189,7 +200,7 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
RegisterSingleInstance(networkManager);
|
RegisterSingleInstance(networkManager);
|
||||||
RegisterSingleInstance(serverManager);
|
RegisterSingleInstance(serverManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of types within an assembly
|
/// Gets a list of types within an assembly
|
||||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||||
@ -353,7 +364,7 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
/// <param name="autorun">if set to <c>true</c> [autorun].</param>
|
/// <param name="autorun">if set to <c>true</c> [autorun].</param>
|
||||||
public void ConfigureAutoRunAtStartup(bool autorun)
|
public void ConfigureAutoRunAtStartup(bool autorun)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -110,5 +110,11 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plugin">The plugin.</param>
|
/// <param name="plugin">The plugin.</param>
|
||||||
void RemovePlugin(IPlugin plugin);
|
void RemovePlugin(IPlugin plugin);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Inits this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
protected async void LoadKernel()
|
protected async void LoadKernel()
|
||||||
{
|
{
|
||||||
CompositionRoot = new ApplicationHost();
|
CompositionRoot = new ApplicationHost();
|
||||||
|
await CompositionRoot.Init();
|
||||||
|
|
||||||
Logger = CompositionRoot.Logger;
|
Logger = CompositionRoot.Logger;
|
||||||
Kernel = CompositionRoot.Kernel;
|
Kernel = CompositionRoot.Kernel;
|
||||||
|
@ -78,6 +78,16 @@ namespace MediaBrowser.ServerApplication
|
|||||||
public ApplicationHost()
|
public ApplicationHost()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Inits this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
public override async Task Init()
|
||||||
|
{
|
||||||
|
await base.Init().ConfigureAwait(false);
|
||||||
|
|
||||||
Kernel = new Kernel(this, ServerApplicationPaths, _xmlSerializer, Logger);
|
Kernel = new Kernel(this, ServerApplicationPaths, _xmlSerializer, Logger);
|
||||||
|
|
||||||
var networkManager = new NetworkManager();
|
var networkManager = new NetworkManager();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.24</version>
|
<version>3.0.25</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.24" />
|
<dependency id="MediaBrowser.Common" version="3.0.25" />
|
||||||
<dependency id="NLog" version="2.0.0.2000" />
|
<dependency id="NLog" version="2.0.0.2000" />
|
||||||
<dependency id="ServiceStack" version="3.9.37" />
|
<dependency id="ServiceStack" version="3.9.37" />
|
||||||
<dependency id="ServiceStack.Api.Swagger" version="3.9.35" />
|
<dependency id="ServiceStack.Api.Swagger" version="3.9.35" />
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.24</version>
|
<version>3.0.25</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.24</version>
|
<version>3.0.25</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.24" />
|
<dependency id="MediaBrowser.Common" version="3.0.25" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user