mirror of
https://github.com/fergalmoran/Readarr.git
synced 2025-12-22 09:29:59 +00:00
* New: Health Check Failure Notifications Fixes #295 * New: OnDownloadFailure and OnImportFailure Notification * New: On Retag notifications * Fixed: XBMC notification test * New: Discord Notifications Closes #1511 * On Download to On Import on card * Remove OnDownload, Rename OnAlbumDownload -> OnReleaseImported * Fixed: Webhook OnReleaseImport notification * Respect OnUpgrade and fix missing schema items for frontend * New: Simplify Notification Modal UI * Fixed: PlexHomeTheater OnReleaseImport notification
84 lines
3.5 KiB
C#
84 lines
3.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NLog;
|
|
using NzbDrone.Common.Composition;
|
|
using NzbDrone.Core.Messaging.Events;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
|
|
namespace NzbDrone.Core.Notifications
|
|
{
|
|
public interface INotificationFactory : IProviderFactory<INotification, NotificationDefinition>
|
|
{
|
|
List<INotification> OnGrabEnabled();
|
|
List<INotification> OnReleaseImportEnabled();
|
|
List<INotification> OnUpgradeEnabled();
|
|
List<INotification> OnRenameEnabled();
|
|
List<INotification> OnHealthIssueEnabled();
|
|
List<INotification> OnDownloadFailureEnabled();
|
|
List<INotification> OnImportFailureEnabled();
|
|
List<INotification> OnTrackRetagEnabled();
|
|
}
|
|
|
|
public class NotificationFactory : ProviderFactory<INotification, NotificationDefinition>, INotificationFactory
|
|
{
|
|
public NotificationFactory(INotificationRepository providerRepository, IEnumerable<INotification> providers, IContainer container, IEventAggregator eventAggregator, Logger logger)
|
|
: base(providerRepository, providers, container, eventAggregator, logger)
|
|
{
|
|
}
|
|
|
|
public List<INotification> OnGrabEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnGrab).ToList();
|
|
}
|
|
|
|
public List<INotification> OnReleaseImportEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnReleaseImport).ToList();
|
|
}
|
|
|
|
public List<INotification> OnUpgradeEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnUpgrade).ToList();
|
|
}
|
|
|
|
public List<INotification> OnRenameEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
|
|
}
|
|
|
|
public List<INotification> OnHealthIssueEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthIssue).ToList();
|
|
}
|
|
|
|
public List<INotification> OnDownloadFailureEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnDownloadFailure).ToList();
|
|
}
|
|
|
|
public List<INotification> OnImportFailureEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnImportFailure).ToList();
|
|
}
|
|
|
|
public List<INotification> OnTrackRetagEnabled()
|
|
{
|
|
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnTrackRetag).ToList();
|
|
}
|
|
|
|
public override void SetProviderCharacteristics(INotification provider, NotificationDefinition definition)
|
|
{
|
|
base.SetProviderCharacteristics(provider, definition);
|
|
|
|
definition.SupportsOnGrab = provider.SupportsOnGrab;
|
|
definition.SupportsOnReleaseImport = provider.SupportsOnReleaseImport;
|
|
definition.SupportsOnUpgrade = provider.SupportsOnUpgrade;
|
|
definition.SupportsOnRename = provider.SupportsOnRename;
|
|
definition.SupportsOnHealthIssue = provider.SupportsOnHealthIssue;
|
|
definition.SupportsOnDownloadFailure = provider.SupportsOnDownloadFailure;
|
|
definition.SupportsOnImportFailure = provider.SupportsOnImportFailure;
|
|
definition.SupportsOnTrackRetag = provider.SupportsOnTrackRetag;
|
|
}
|
|
}
|
|
}
|