Fixed: Don't clean Kodi library if Always Update is disabled and video is playing
Fixes #2773
This commit is contained in:
parent
ad69ecc5eb
commit
b73b99df8d
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -53,6 +53,18 @@ namespace NzbDrone.Core.Notifications.Xbmc
|
||||||
|
|
||||||
public void Clean(XbmcSettings settings)
|
public void Clean(XbmcSettings settings)
|
||||||
{
|
{
|
||||||
|
if (!settings.AlwaysUpdate)
|
||||||
|
{
|
||||||
|
_logger.Debug("Determining if there are any active players on XBMC host: {0}", settings.Address);
|
||||||
|
var activePlayers = GetActivePlayers(settings);
|
||||||
|
|
||||||
|
if (activePlayers.Any(a => a.Type.Equals("video")))
|
||||||
|
{
|
||||||
|
_logger.Debug("Video is currently playing, skipping library cleaning");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const string cleanVideoLibrary = "CleanLibrary(video)";
|
const string cleanVideoLibrary = "CleanLibrary(video)";
|
||||||
var command = BuildExecBuiltInCommand(cleanVideoLibrary);
|
var command = BuildExecBuiltInCommand(cleanVideoLibrary);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
|
||||||
if (!settings.AlwaysUpdate)
|
if (!settings.AlwaysUpdate)
|
||||||
{
|
{
|
||||||
_logger.Debug("Determining if there are any active players on XBMC host: {0}", settings.Address);
|
_logger.Debug("Determining if there are any active players on XBMC host: {0}", settings.Address);
|
||||||
var activePlayers = _proxy.GetActivePlayers(settings);
|
var activePlayers = GetActivePlayers(settings);
|
||||||
|
|
||||||
if (activePlayers.Any(a => a.Type.Equals("video")))
|
if (activePlayers.Any(a => a.Type.Equals("video")))
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,18 @@ namespace NzbDrone.Core.Notifications.Xbmc
|
||||||
|
|
||||||
public void Clean(XbmcSettings settings)
|
public void Clean(XbmcSettings settings)
|
||||||
{
|
{
|
||||||
|
if (!settings.AlwaysUpdate)
|
||||||
|
{
|
||||||
|
_logger.Debug("Determining if there are any active players on XBMC host: {0}", settings.Address);
|
||||||
|
var activePlayers = GetActivePlayers(settings);
|
||||||
|
|
||||||
|
if (activePlayers.Any(a => a.Type.Equals("video")))
|
||||||
|
{
|
||||||
|
_logger.Debug("Video is currently playing, skipping library cleaning");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_proxy.CleanLibrary(settings);
|
_proxy.CleanLibrary(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue