From 1b6f6845222170af64c6138517f6c9aaafb084bb Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Mon, 13 Oct 2014 10:36:51 -0700 Subject: [PATCH] New: Added health check to show a warning when MediaInfo is missing --- .../HealthCheck/Checks/MediaInfoDllCheck.cs | 32 +++++++++++++++++++ src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + 2 files changed, 33 insertions(+) create mode 100644 src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs new file mode 100644 index 000000000..f8eab9451 --- /dev/null +++ b/src/NzbDrone.Core/HealthCheck/Checks/MediaInfoDllCheck.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.CompilerServices; +using MediaInfoLib; + +namespace NzbDrone.Core.HealthCheck.Checks +{ + public class MediaInfoDllCheck : HealthCheckBase + { + [MethodImpl(MethodImplOptions.NoOptimization)] + public override HealthCheck Check() + { + try + { + var mediaInfo = new MediaInfo(); + } + catch (Exception e) + { + return new HealthCheck(GetType(), HealthCheckResult.Warning, "MediaInfo could not be loaded " + e.Message); + } + + return new HealthCheck(GetType()); + } + + public override bool CheckOnConfigChange + { + get + { + return false; + } + } + } +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 3e406929a..56b13d5fe 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -359,6 +359,7 @@ +