From 459e483b4e9f5f4a8284ef450733a215ba4ac334 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 30 Sep 2015 00:07:21 -0400 Subject: [PATCH 1/3] fix windows restart hang --- .../Security/PluginSecurityManager.cs | 11 ++++++++--- MediaBrowser.ServerApplication/MainStartup.cs | 12 ++++-------- MediaBrowser.ServerApplication/ServerNotifyIcon.cs | 13 +++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index 39dd41356..c2725e9bf 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -158,9 +158,14 @@ namespace MediaBrowser.Common.Implementations.Security return new SupporterInfo(); } - var url = MbAdmin.HttpsUrl + "/service/supporter/retrieve?key=" + key; + var data = new Dictionary + { + { "key", key }, + }; - using (var stream = await _httpClient.Get(url, CancellationToken.None).ConfigureAwait(false)) + var url = MbAdmin.HttpsUrl + "/service/supporter/retrieve"; + + using (var stream = await _httpClient.Post(url, data, CancellationToken.None).ConfigureAwait(false)) { var response = _jsonSerializer.DeserializeFromStream(stream); @@ -269,4 +274,4 @@ namespace MediaBrowser.Common.Implementations.Security _isMbSupporterInitialized = false; } } -} +} \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 968172bc3..d7b8b2aed 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -214,7 +214,7 @@ namespace MediaBrowser.ServerApplication fileSystem, "MBServer", nativeApp); - + var initProgress = new Progress(); if (!runService) @@ -513,23 +513,19 @@ namespace MediaBrowser.ServerApplication if (!_isRunningAsService) { - _logger.Info("Hiding server notify icon"); - _serverNotifyIcon.Visible = false; + //_logger.Info("Hiding server notify icon"); + //_serverNotifyIcon.Visible = false; _logger.Info("Starting new instance"); //Application.Restart(); Process.Start(_appHost.ServerConfigurationManager.ApplicationPaths.ApplicationPath); - _logger.Info("Calling Environment.Exit"); - Environment.Exit(0); + ShutdownWindowsApplication(); } } private static void ShutdownWindowsApplication() { - _logger.Info("Hiding server notify icon"); - _serverNotifyIcon.Visible = false; - _logger.Info("Calling Application.Exit"); Application.Exit(); diff --git a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs index 725720731..ad0bd8a1a 100644 --- a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs +++ b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs @@ -168,6 +168,19 @@ namespace MediaBrowser.ServerApplication } notifyIcon1.DoubleClick += notifyIcon1_DoubleClick; + Application.ApplicationExit += Application_ApplicationExit; + } + + void Application_ApplicationExit(object sender, EventArgs e) + { + try + { + notifyIcon1.Visible = false; + } + catch + { + + } } void notifyIcon1_DoubleClick(object sender, EventArgs e) From f9b4b98d0e171fb61cea7ecab2bf280ac14d38aa Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 30 Sep 2015 00:07:56 -0400 Subject: [PATCH 2/3] fix ffprobe data stream causing subtitle streams to be out of order --- MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 9fc8e1f8a..9725d7b06 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -488,7 +488,8 @@ namespace MediaBrowser.Providers.MediaInfo { var subtitleResolver = new SubtitleResolver(_localization, _fileSystem); - var externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, currentStreams.Count, options.DirectoryService, false).ToList(); + var startIndex = currentStreams.Count == 0 ? 0 : (currentStreams.Select(i => i.Index).Max() + 1); + var externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, startIndex, options.DirectoryService, false).ToList(); var enableSubtitleDownloading = options.MetadataRefreshMode == MetadataRefreshMode.Default || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh; @@ -512,7 +513,7 @@ namespace MediaBrowser.Providers.MediaInfo // Rescan if (downloadedLanguages.Count > 0) { - externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, currentStreams.Count, options.DirectoryService, true).ToList(); + externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, startIndex, options.DirectoryService, true).ToList(); } } From c0dc8d055bfd4d2f58591083beb9e9128357aad6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 30 Sep 2015 00:08:07 -0400 Subject: [PATCH 3/3] 3.0.5724.6 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 36ee8dbfa..30ce35ee1 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; //[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5724.5")] +[assembly: AssemblyVersion("3.0.5724.6")]