From b8559ccec343c287dde684dee1bca30eaad4a60c Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 4 Jan 2012 11:48:48 -0800 Subject: [PATCH] Added hidden option to allow updating of XBMC even if video is playing. --- .../Providers/Core/ConfigProvider.cs | 7 ++++ NzbDrone.Core/Providers/XbmcProvider.cs | 36 +++++++++++-------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 16c69015e..407fbc6f1 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -230,6 +230,13 @@ namespace NzbDrone.Core.Providers.Core set { SetValue("XbmcCleanLibrary", value); } } + public virtual Boolean XbmcUpdateWhenPlaying + { + get { return GetValueBoolean("XbmcUpdateWhenPlaying"); } + + set { SetValue("XbmcUpdateWhenPlaying", value); } + } + public virtual string XbmcHosts { get { return GetValue("XbmcHosts", "localhost:8080"); } diff --git a/NzbDrone.Core/Providers/XbmcProvider.cs b/NzbDrone.Core/Providers/XbmcProvider.cs index 0bcbf0784..a32199431 100644 --- a/NzbDrone.Core/Providers/XbmcProvider.cs +++ b/NzbDrone.Core/Providers/XbmcProvider.cs @@ -61,14 +61,18 @@ namespace NzbDrone.Core.Providers //If Dharma if (version == 2) { - Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); - var activePlayers = GetActivePlayersDharma(host, username, password); - - //If video is currently playing, then skip update - if (activePlayers["video"]) + //Check for active player only when we should skip updates when playing + if (!_configProvider.XbmcUpdateWhenPlaying) { - Logger.Debug("Video is currently playing, skipping library update"); - continue; + Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); + var activePlayers = GetActivePlayersDharma(host, username, password); + + //If video is currently playing, then skip update + if(activePlayers["video"]) + { + Logger.Debug("Video is currently playing, skipping library update"); + continue; + } } UpdateWithHttp(series, host, username, password); @@ -77,14 +81,18 @@ namespace NzbDrone.Core.Providers //If Eden or newer (attempting to make it future compatible) else if (version >= 3) { - Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); - var activePlayers = GetActivePlayersEden(host, username, password); - - //If video is currently playing, then skip update - if (activePlayers.Any(a => a.Type.Equals("video"))) + //Check for active player only when we should skip updates when playing + if (!_configProvider.XbmcUpdateWhenPlaying) { - Logger.Debug("Video is currently playing, skipping library update"); - continue; + Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); + var activePlayers = GetActivePlayersEden(host, username, password); + + //If video is currently playing, then skip update + if(activePlayers.Any(a => a.Type.Equals("video"))) + { + Logger.Debug("Video is currently playing, skipping library update"); + continue; + } } UpdateWithJson(series, password, host, username);