mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 16:06:24 +02:00
external notifications are now based on Events.
This commit is contained in:
59
NzbDrone.Core/ExternalNotification/Xbmc.cs
Normal file
59
NzbDrone.Core/ExternalNotification/Xbmc.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.ExternalNotification
|
||||
{
|
||||
public class Xbmc : ExternalNotificationBase
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly XbmcProvider _xbmcProvider;
|
||||
|
||||
public Xbmc(IConfigService configService, IExternalNotificationRepository repository, XbmcProvider xbmcProvider, Logger logger)
|
||||
: base(repository, logger)
|
||||
{
|
||||
_configService = configService;
|
||||
_xbmcProvider = xbmcProvider;
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "XBMC"; }
|
||||
}
|
||||
|
||||
protected override void OnGrab(string message)
|
||||
{
|
||||
const string header = "NzbDrone [TV] - Grabbed";
|
||||
|
||||
_xbmcProvider.Notify(header, message);
|
||||
}
|
||||
|
||||
protected override void OnDownload(string message, Series series)
|
||||
{
|
||||
const string header = "NzbDrone [TV] - Downloaded";
|
||||
|
||||
_xbmcProvider.Notify(header, message);
|
||||
UpdateAndClean(series);
|
||||
}
|
||||
|
||||
protected override void AfterRename(Series series)
|
||||
{
|
||||
UpdateAndClean(series);
|
||||
}
|
||||
|
||||
private void UpdateAndClean(Series series)
|
||||
{
|
||||
if (_configService.XbmcUpdateLibrary)
|
||||
{
|
||||
_xbmcProvider.Update(series);
|
||||
}
|
||||
|
||||
if (_configService.XbmcCleanLibrary)
|
||||
{
|
||||
_xbmcProvider.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user