diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2015-10-16 18:36:41 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2015-10-16 18:36:41 -0400 |
| commit | 8ef0596f0fa9fe0259bd1f706a92d4eab1bc4c93 (patch) | |
| tree | 90c952932ccc958055cad2500ab4764ec281ad67 /MediaBrowser.Server.Startup.Common | |
| parent | 1261f51412fe6c3ddab12f615026b2c4ecc4b62b (diff) | |
| parent | d1195257aa6ffa8086ce6461183442ffa28365f3 (diff) | |
Merge branch 'dev' of https://github.com/MediaBrowser/Emby into dev
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
3 files changed, 57 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 0f01e8aea..bcb75d9a0 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -333,18 +333,18 @@ namespace MediaBrowser.Server.Startup.Common }); LogManager.RemoveConsoleOutput(); + + PerformPostInitMigrations(); } - public override async Task Init(IProgress<double> progress) + public override Task Init(IProgress<double> progress) { HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber; HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber; PerformPreInitMigrations(); - await base.Init(progress).ConfigureAwait(false); - - PerformPostInitMigrations(); + return base.Init(progress); } private void PerformPreInitMigrations() @@ -362,7 +362,10 @@ namespace MediaBrowser.Server.Startup.Common private void PerformPostInitMigrations() { - var migrations = new List<IVersionMigration>(); + var migrations = new List<IVersionMigration> + { + new Release5767(ServerConfigurationManager, TaskManager) + }; foreach (var task in migrations) { @@ -563,7 +566,7 @@ namespace MediaBrowser.Server.Startup.Common int.TryParse(_startupOptions.GetOption("-imagethreads"), NumberStyles.Any, CultureInfo.InvariantCulture, out maxConcurrentImageProcesses); } - return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses); + return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, GetImageEncoder(), maxConcurrentImageProcesses, () => LibraryManager); } private IImageEncoder GetImageEncoder() diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 9def89073..13b782e40 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -72,6 +72,7 @@ <Compile Include="INativeApp.cs" /> <Compile Include="MbLinkShortcutHandler.cs" /> <Compile Include="Migrations\IVersionMigration.cs" /> + <Compile Include="Migrations\Release5767.cs" /> <Compile Include="Migrations\RenameXmlOptions.cs" /> <Compile Include="NativeEnvironment.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs b/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs new file mode 100644 index 000000000..9a4580c12 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/Migrations/Release5767.cs @@ -0,0 +1,47 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Server.Implementations.LiveTv; +using MediaBrowser.Server.Implementations.Persistence; +using MediaBrowser.Server.Implementations.ScheduledTasks; + +namespace MediaBrowser.Server.Startup.Common.Migrations +{ + public class Release5767 : IVersionMigration + { + private readonly IServerConfigurationManager _config; + private readonly ITaskManager _taskManager; + + public Release5767(IServerConfigurationManager config, ITaskManager taskManager) + { + _config = config; + _taskManager = taskManager; + } + + public void Run() + { + var name = "5767"; + + if (_config.Configuration.Migrations.Contains(name, StringComparer.OrdinalIgnoreCase)) + { + return; + } + + Task.Run(async () => + { + await Task.Delay(3000).ConfigureAwait(false); + + _taskManager.QueueScheduledTask<RefreshChannelsScheduledTask>(); + _taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>(); + _taskManager.QueueScheduledTask<RefreshMediaLibraryTask>(); + }); + + var list = _config.Configuration.Migrations.ToList(); + list.Add(name); + _config.Configuration.Migrations = list.ToArray(); + _config.SaveConfiguration(); + } + } +} |
