mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
external notifications are now based on Events.
This commit is contained in:
parent
a866c419e1
commit
5fc25b6095
32 changed files with 542 additions and 619 deletions
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue