diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 02d7cb31f..9c9e14ec6 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -795,6 +795,8 @@ return null; /// public void NotifyPendingRestart() { + Logger.Info("App needs to be restarted."); + var changed = !HasPendingRestart; HasPendingRestart = true; diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index 3590ade40..215ac8492 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -1083,6 +1083,8 @@ namespace Emby.Server.Core if (requiresRestart) { + Logger.Info("App needs to be restarted due to configuration change."); + NotifyPendingRestart(); } } @@ -1204,7 +1206,8 @@ namespace Emby.Server.Core var exclude = new[] { "mbplus.dll", - "mbintros.dll" + "mbintros.dll", + "embytv.dll" }; return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase); diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs index 38708648f..561f5ee12 100644 --- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs @@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints if (_appHost.HasPendingRestart) { - _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10)); + _timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15)); } } @@ -65,6 +65,8 @@ namespace Emby.Server.Implementations.EntryPoints { DisposeTimer(); + _logger.Info("Automatically restarting the system because it is idle and a restart is required."); + try { _appHost.Restart(); diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs index 0e1f5a551..83885ee2e 100644 --- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -228,11 +228,14 @@ namespace Emby.Server.Implementations.HttpServer } } - private void ErrorHandler(Exception ex, IRequest httpReq) + private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true) { try { - _logger.ErrorException("Error processing request", ex); + if (logException) + { + _logger.ErrorException("Error processing request", ex); + } var httpRes = httpReq.Response; @@ -529,6 +532,10 @@ namespace Emby.Server.Implementations.HttpServer ErrorHandler(new FileNotFoundException(), httpReq); } } + catch (OperationCanceledException ex) + { + ErrorHandler(ex, httpReq, false); + } catch (Exception ex) { ErrorHandler(ex, httpReq); diff --git a/Emby.Server.Implementations/HttpServer/IHttpListener.cs b/Emby.Server.Implementations/HttpServer/IHttpListener.cs index 9f96a8e49..18df5682d 100644 --- a/Emby.Server.Implementations/HttpServer/IHttpListener.cs +++ b/Emby.Server.Implementations/HttpServer/IHttpListener.cs @@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer /// Gets or sets the error handler. /// /// The error handler. - Action ErrorHandler { get; set; } + Action ErrorHandler { get; set; } /// /// Gets or sets the request handler. diff --git a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs index 4606d0e31..652fc4f83 100644 --- a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs +++ b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpListener.cs @@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp _httpRequestFactory = httpRequestFactory; } - public Action ErrorHandler { get; set; } + public Action ErrorHandler { get; set; } public Func RequestHandler { get; set; } public Action WebSocketConnecting { get; set; } @@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp _logger.ErrorException("Error processing request", ex); httpReq = httpReq ?? GetRequest(context); - ErrorHandler(ex, httpReq); + ErrorHandler(ex, httpReq, true); return Task.FromResult(true); } diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 538512557..22e7e753c 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -87,6 +87,12 @@ namespace MediaBrowser.Providers.TV var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); + // Doesn't have required provider id's + if (string.IsNullOrWhiteSpace(seriesDataPath)) + { + return; + } + var episodeFiles = _fileSystem.GetFilePaths(seriesDataPath) .Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase)) .Select(Path.GetFileNameWithoutExtension)