Added hidden option to allow updating of XBMC even if video is playing.

pull/3113/head
Mark McDowall 13 years ago
parent e4985cbd66
commit b8559ccec3

@ -230,6 +230,13 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("XbmcCleanLibrary", value); } set { SetValue("XbmcCleanLibrary", value); }
} }
public virtual Boolean XbmcUpdateWhenPlaying
{
get { return GetValueBoolean("XbmcUpdateWhenPlaying"); }
set { SetValue("XbmcUpdateWhenPlaying", value); }
}
public virtual string XbmcHosts public virtual string XbmcHosts
{ {
get { return GetValue("XbmcHosts", "localhost:8080"); } get { return GetValue("XbmcHosts", "localhost:8080"); }

@ -60,32 +60,40 @@ namespace NzbDrone.Core.Providers
//If Dharma //If Dharma
if (version == 2) if (version == 2)
{
//Check for active player only when we should skip updates when playing
if (!_configProvider.XbmcUpdateWhenPlaying)
{ {
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
var activePlayers = GetActivePlayersDharma(host, username, password); var activePlayers = GetActivePlayersDharma(host, username, password);
//If video is currently playing, then skip update //If video is currently playing, then skip update
if (activePlayers["video"]) if(activePlayers["video"])
{ {
Logger.Debug("Video is currently playing, skipping library update"); Logger.Debug("Video is currently playing, skipping library update");
continue; continue;
} }
}
UpdateWithHttp(series, host, username, password); UpdateWithHttp(series, host, username, password);
} }
//If Eden or newer (attempting to make it future compatible) //If Eden or newer (attempting to make it future compatible)
else if (version >= 3) else if (version >= 3)
{
//Check for active player only when we should skip updates when playing
if (!_configProvider.XbmcUpdateWhenPlaying)
{ {
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host); Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
var activePlayers = GetActivePlayersEden(host, username, password); var activePlayers = GetActivePlayersEden(host, username, password);
//If video is currently playing, then skip update //If video is currently playing, then skip update
if (activePlayers.Any(a => a.Type.Equals("video"))) if(activePlayers.Any(a => a.Type.Equals("video")))
{ {
Logger.Debug("Video is currently playing, skipping library update"); Logger.Debug("Video is currently playing, skipping library update");
continue; continue;
} }
}
UpdateWithJson(series, password, host, username); UpdateWithJson(series, password, host, username);
} }

Loading…
Cancel
Save