diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs
index 291c67156..09bb67218 100644
--- a/MediaBrowser.Common/Kernel/BaseKernel.cs
+++ b/MediaBrowser.Common/Kernel/BaseKernel.cs
@@ -11,13 +11,14 @@ using MediaBrowser.Common.Json;
using MediaBrowser.Common.Logging;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
+using MediaBrowser.Common.Progress;
namespace MediaBrowser.Common.Kernel
{
///
/// Represents a shared base kernel for both the UI and server apps
///
- public abstract class BaseKernel
+ public abstract class BaseKernel : IDisposable
where TConfigurationType : BaseApplicationConfiguration, new()
{
///
@@ -76,12 +77,12 @@ namespace MediaBrowser.Common.Kernel
Logger.LoggerInstance = new FileLogger(Path.Combine(ProgramDataPath, "Logs"));
}
- public virtual void Init()
+ public virtual void Init(IProgress progress)
{
ReloadConfiguration();
ReloadHttpServer();
-
+
ReloadComposableParts();
}
@@ -206,13 +207,18 @@ namespace MediaBrowser.Common.Kernel
/// Restarts the Http Server, or starts it if not currently running
///
private void ReloadHttpServer()
+ {
+ DisposeHttpServer();
+
+ HttpServer = new HttpServer("http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/");
+ }
+
+ private void DisposeHttpServer()
{
if (HttpServer != null)
{
HttpServer.Dispose();
}
-
- HttpServer = new HttpServer("http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/");
}
///
@@ -234,5 +240,10 @@ namespace MediaBrowser.Common.Kernel
return null;
}
+
+ public void Dispose()
+ {
+ DisposeHttpServer();
+ }
}
}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 65c001889..53a1c7121 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -67,6 +67,7 @@
+
diff --git a/MediaBrowser.Common/Progress/TaskProgress.cs b/MediaBrowser.Common/Progress/TaskProgress.cs
new file mode 100644
index 000000000..78e817397
--- /dev/null
+++ b/MediaBrowser.Common/Progress/TaskProgress.cs
@@ -0,0 +1,19 @@
+
+namespace MediaBrowser.Common.Progress
+{
+ ///
+ /// Represents a generic progress class that can be used with IProgress
+ ///
+ public class TaskProgress
+ {
+ ///
+ /// Gets or sets the current completion percentage
+ ///
+ public decimal PercentComplete { get; set; }
+
+ ///
+ /// Gets or sets a description of the actions currently executing
+ ///
+ public string Description { get; set; }
+ }
+}
diff --git a/MediaBrowser.Program/Program.cs b/MediaBrowser.Program/Program.cs
index ff7ad002f..a951ec7db 100644
--- a/MediaBrowser.Program/Program.cs
+++ b/MediaBrowser.Program/Program.cs
@@ -1,5 +1,6 @@
using System;
using MediaBrowser.Controller;
+using MediaBrowser.Common.Progress;
namespace MediaBrowser.Program
{
@@ -18,7 +19,9 @@ namespace MediaBrowser.Program
Kernel kernel = new Kernel();
- kernel.Init();
+ Progress progress = new Progress();
+
+ kernel.Init(progress);
var time = DateTime.Now - now;
Console.WriteLine("Done in " + time.TotalSeconds + " seconds");