diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 8bd203dcd..fe0abcae0 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Archiving; +using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.NetworkManagement; using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; @@ -156,6 +157,8 @@ namespace MediaBrowser.Common.Implementations /// /// The zip client. protected IZipClient ZipClient { get; set; } + + protected IIsoManager IsoManager { get; set; } /// /// Initializes a new instance of the class. @@ -193,18 +196,54 @@ namespace MediaBrowser.Common.Implementations await RegisterResources().ConfigureAwait(false); FindParts(); + + await InstallIsoMounters(CancellationToken.None).ConfigureAwait(false); } + /// + /// Called when [logger loaded]. + /// protected virtual void OnLoggerLoaded() { } + /// + /// Installs the iso mounters. + /// + /// The cancellation token. + /// Task. + private async Task InstallIsoMounters(CancellationToken cancellationToken) + { + var list = new List(); + + foreach (var isoMounter in GetExports()) + { + try + { + if (isoMounter.RequiresInstallation && !isoMounter.IsInstalled) + { + Logger.Info("Installing {0}", isoMounter.Name); + + await isoMounter.Install(cancellationToken).ConfigureAwait(false); + } + + list.Add(isoMounter); + } + catch (Exception ex) + { + Logger.ErrorException("{0} failed to load.", ex, isoMounter.Name); + } + } + + IsoManager.AddParts(list); + } + /// /// Runs the startup tasks. /// /// Task. - public virtual Task RunStartupTasks() + public virtual Task RunStartupTasks() { return Task.Run(() => { @@ -307,6 +346,9 @@ namespace MediaBrowser.Common.Implementations ZipClient = new ZipClient(); RegisterSingleInstance(ZipClient); + + IsoManager = new IsoManager(); + RegisterSingleInstance(IsoManager); }); } diff --git a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs index bdeaf70dc..282952dba 100644 --- a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs +++ b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs @@ -1,5 +1,5 @@ -using System; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; +using System; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Model/IO/IIsoMounter.cs b/MediaBrowser.Model/IO/IIsoMounter.cs index 91a045368..6684e7eff 100644 --- a/MediaBrowser.Model/IO/IIsoMounter.cs +++ b/MediaBrowser.Model/IO/IIsoMounter.cs @@ -23,5 +23,29 @@ namespace MediaBrowser.Model.IO /// The path. /// true if this instance can mount the specified path; otherwise, false. bool CanMount(string path); + + /// + /// Gets a value indicating whether [requires installation]. + /// + /// true if [requires installation]; otherwise, false. + bool RequiresInstallation { get; } + + /// + /// Gets a value indicating whether this instance is installed. + /// + /// true if this instance is installed; otherwise, false. + bool IsInstalled { get; } + + /// + /// Installs this instance. + /// + /// Task. + Task Install(CancellationToken cancellationToken); + + /// + /// Gets the name. + /// + /// The name. + string Name { get; } } } diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs index 7bfebdfe9..9b978ca2d 100644 --- a/MediaBrowser.ServerApplication/App.xaml.cs +++ b/MediaBrowser.ServerApplication/App.xaml.cs @@ -79,13 +79,13 @@ namespace MediaBrowser.ServerApplication await _appHost.Init(); + var task = _appHost.RunStartupTasks(); + if (!IsRunningAsService) { HideSplashWindow(); } - var task = _appHost.RunStartupTasks(); - if (!IsRunningAsService) { ShowMainWindow(); diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 6f099e7bb..365e81bae 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -4,7 +4,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Constants; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Implementations; -using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.MediaInfo; using MediaBrowser.Common.Net; @@ -25,7 +24,6 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.System; @@ -152,7 +150,6 @@ namespace MediaBrowser.ServerApplication /// The media encoder. private IMediaEncoder MediaEncoder { get; set; } - private IIsoManager IsoManager { get; set; } private ISessionManager SessionManager { get; set; } private ILiveTvManager LiveTvManager { get; set; } @@ -237,9 +234,6 @@ namespace MediaBrowser.ServerApplication RegisterSingleInstance(() => new AlchemyServer(Logger)); - IsoManager = new IsoManager(); - RegisterSingleInstance(IsoManager); - RegisterSingleInstance(() => new BdInfoExaminer()); var mediaEncoderTask = RegisterMediaEncoder(); @@ -271,7 +265,7 @@ namespace MediaBrowser.ServerApplication RegisterSingleInstance(() => new LuceneSearchEngine(ApplicationPaths, LogManager, LibraryManager)); SessionManager = new SessionManager(UserDataRepository, ServerConfigurationManager, Logger, UserRepository); - RegisterSingleInstance(SessionManager); + RegisterSingleInstance(SessionManager); HttpServer = await _httpServerCreationTask.ConfigureAwait(false); RegisterSingleInstance(HttpServer, false); @@ -326,6 +320,10 @@ namespace MediaBrowser.ServerApplication ); } + /// + /// Gets the user repository. + /// + /// Task{IUserRepository}. private async Task GetUserRepository() { var repo = new SqliteUserRepository(JsonSerializer, LogManager, ApplicationPaths); @@ -425,8 +423,6 @@ namespace MediaBrowser.ServerApplication ProviderManager.AddParts(GetExports()); - IsoManager.AddParts(GetExports()); - SessionManager.AddParts(GetExports()); ImageProcessor.AddParts(GetExports()); diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index fb6e060a0..47bdc65aa 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -119,9 +119,9 @@ ..\packages\Hardcodet.Wpf.TaskbarNotification.1.0.4.0\lib\net40\Hardcodet.Wpf.TaskbarNotification.dll - + False - ..\packages\MediaBrowser.IsoMounting.3.0.56\lib\net45\MediaBrowser.IsoMounter.dll + ..\packages\MediaBrowser.IsoMounting.3.0.60\lib\net45\MediaBrowser.IsoMounter.dll False @@ -129,7 +129,7 @@ False - ..\packages\MediaBrowser.IsoMounting.3.0.56\lib\net45\pfmclrapi.dll + ..\packages\MediaBrowser.IsoMounting.3.0.60\lib\net45\pfmclrapi.dll False diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 39984f8f9..f0601d401 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,7 +1,7 @@  - + diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 828ef9199..fdeb192c6 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -918,9 +918,6 @@ PreserveNewest - - PreserveNewest - diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 0513cf965..4da295306 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.211 + 3.0.212 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index ece6a953f..8adccf8b5 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.211 + 3.0.212 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 79ee65283..9b18ef86d 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.211 + 3.0.212 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +