parent
619ac557f9
commit
dec6e14036
|
@ -58,6 +58,7 @@ class Notification extends Component {
|
|||
onDownload,
|
||||
onUpgrade,
|
||||
onRename,
|
||||
onSeriesAdd,
|
||||
onSeriesDelete,
|
||||
onEpisodeFileDelete,
|
||||
onEpisodeFileDeleteForUpgrade,
|
||||
|
@ -67,6 +68,7 @@ class Notification extends Component {
|
|||
supportsOnDownload,
|
||||
supportsOnUpgrade,
|
||||
supportsOnRename,
|
||||
supportsOnSeriesAdd,
|
||||
supportsOnSeriesDelete,
|
||||
supportsOnEpisodeFileDelete,
|
||||
supportsOnEpisodeFileDeleteForUpgrade,
|
||||
|
@ -132,6 +134,14 @@ class Notification extends Component {
|
|||
null
|
||||
}
|
||||
|
||||
{
|
||||
supportsOnSeriesAdd && onSeriesAdd ?
|
||||
<Label kind={kinds.SUCCESS}>
|
||||
On Series Add
|
||||
</Label> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
supportsOnSeriesDelete && onSeriesDelete ?
|
||||
<Label kind={kinds.SUCCESS}>
|
||||
|
@ -195,6 +205,7 @@ Notification.propTypes = {
|
|||
onDownload: PropTypes.bool.isRequired,
|
||||
onUpgrade: PropTypes.bool.isRequired,
|
||||
onRename: PropTypes.bool.isRequired,
|
||||
onSeriesAdd: PropTypes.bool.isRequired,
|
||||
onSeriesDelete: PropTypes.bool.isRequired,
|
||||
onEpisodeFileDelete: PropTypes.bool.isRequired,
|
||||
onEpisodeFileDeleteForUpgrade: PropTypes.bool.isRequired,
|
||||
|
@ -202,6 +213,7 @@ Notification.propTypes = {
|
|||
onApplicationUpdate: PropTypes.bool.isRequired,
|
||||
supportsOnGrab: PropTypes.bool.isRequired,
|
||||
supportsOnDownload: PropTypes.bool.isRequired,
|
||||
supportsOnSeriesAdd: PropTypes.bool.isRequired,
|
||||
supportsOnSeriesDelete: PropTypes.bool.isRequired,
|
||||
supportsOnEpisodeFileDelete: PropTypes.bool.isRequired,
|
||||
supportsOnEpisodeFileDeleteForUpgrade: PropTypes.bool.isRequired,
|
||||
|
|
|
@ -18,6 +18,7 @@ function NotificationEventItems(props) {
|
|||
onDownload,
|
||||
onUpgrade,
|
||||
onRename,
|
||||
onSeriesAdd,
|
||||
onSeriesDelete,
|
||||
onEpisodeFileDelete,
|
||||
onEpisodeFileDeleteForUpgrade,
|
||||
|
@ -27,6 +28,7 @@ function NotificationEventItems(props) {
|
|||
supportsOnDownload,
|
||||
supportsOnUpgrade,
|
||||
supportsOnRename,
|
||||
supportsOnSeriesAdd,
|
||||
supportsOnSeriesDelete,
|
||||
supportsOnEpisodeFileDelete,
|
||||
supportsOnEpisodeFileDeleteForUpgrade,
|
||||
|
@ -91,6 +93,17 @@ function NotificationEventItems(props) {
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="onSeriesAdd"
|
||||
helpText="On Series Add"
|
||||
isDisabled={!supportsOnSeriesAdd.value}
|
||||
{...onSeriesAdd}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
|
|
|
@ -106,6 +106,7 @@ export default {
|
|||
selectedSchema.onDownload = selectedSchema.supportsOnDownload;
|
||||
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
|
||||
selectedSchema.onRename = selectedSchema.supportsOnRename;
|
||||
selectedSchema.onSeriesAdd = selectedSchema.supportsOnSeriesAdd;
|
||||
selectedSchema.onSeriesDelete = selectedSchema.supportsOnSeriesDelete;
|
||||
selectedSchema.onEpisodeFileDelete = selectedSchema.supportsOnEpisodeFileDelete;
|
||||
selectedSchema.onEpisodeFileDeleteForUpgrade = selectedSchema.supportsOnEpisodeFileDeleteForUpgrade;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(187)]
|
||||
public class add_on_series_add_to_notifications : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Notifications").AddColumn("OnSeriesAdd").AsBoolean().WithDefaultValue(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,6 +88,7 @@ namespace NzbDrone.Core.Datastore
|
|||
.Ignore(i => i.SupportsOnDownload)
|
||||
.Ignore(i => i.SupportsOnUpgrade)
|
||||
.Ignore(i => i.SupportsOnRename)
|
||||
.Ignore(i => i.SupportsOnSeriesAdd)
|
||||
.Ignore(i => i.SupportsOnSeriesDelete)
|
||||
.Ignore(i => i.SupportsOnEpisodeFileDelete)
|
||||
.Ignore(i => i.SupportsOnEpisodeFileDeleteForUpgrade)
|
||||
|
|
|
@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -216,6 +216,27 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
var series = message.Series;
|
||||
var environmentVariables = new StringDictionary();
|
||||
|
||||
environmentVariables.Add("Sonarr_EventType", "SeriesAdd");
|
||||
environmentVariables.Add("Sonarr_InstanceName", _configFileProvider.InstanceName);
|
||||
environmentVariables.Add("Sonarr_ApplicationUrl", _configService.ApplicationUrl);
|
||||
environmentVariables.Add("Sonarr_Series_Id", series.Id.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Title", series.Title);
|
||||
environmentVariables.Add("Sonarr_Series_TitleSlug", series.TitleSlug);
|
||||
environmentVariables.Add("Sonarr_Series_Path", series.Path);
|
||||
environmentVariables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
||||
environmentVariables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
||||
environmentVariables.Add("Sonarr_Series_Year", series.Year.ToString());
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
var series = deleteMessage.Series;
|
||||
|
|
|
@ -258,6 +258,24 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
var series = message.Series;
|
||||
|
||||
var attachments = new List<Embed>
|
||||
{
|
||||
new Embed
|
||||
{
|
||||
Title = series.Title,
|
||||
Description = message.Message
|
||||
}
|
||||
};
|
||||
|
||||
var payload = CreatePayload("Series Added", attachments);
|
||||
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
var series = deleteMessage.Series;
|
||||
|
|
|
@ -47,6 +47,13 @@ namespace NzbDrone.Core.Notifications.Email
|
|||
SendEmail(Settings, EPISODE_DELETED_TITLE_BRANDED, body);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
var body = $"{message.Message}";
|
||||
|
||||
SendEmail(Settings, SERIES_ADDED_TITLE_BRANDED, body);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
var body = $"{deleteMessage.Message}";
|
||||
|
|
|
@ -38,6 +38,11 @@ namespace NzbDrone.Core.Notifications.Gotify
|
|||
SendNotification(EPISODE_DELETED_TITLE, message.Message, message.Series);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
SendNotification(SERIES_ADDED_TITLE, message.Message, message.Series);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage message)
|
||||
{
|
||||
SendNotification(SERIES_DELETED_TITLE, message.Message, message.Series);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
@ -13,6 +13,7 @@ namespace NzbDrone.Core.Notifications
|
|||
void OnDownload(DownloadMessage message);
|
||||
void OnRename(Series series, List<RenamedEpisodeFile> renamedFiles);
|
||||
void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage);
|
||||
void OnSeriesAdd(SeriesAddMessage message);
|
||||
void OnSeriesDelete(SeriesDeleteMessage deleteMessage);
|
||||
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
|
||||
void OnApplicationUpdate(ApplicationUpdateMessage updateMessage);
|
||||
|
@ -21,6 +22,7 @@ namespace NzbDrone.Core.Notifications
|
|||
bool SupportsOnDownload { get; }
|
||||
bool SupportsOnUpgrade { get; }
|
||||
bool SupportsOnRename { get; }
|
||||
bool SupportsOnSeriesAdd { get; }
|
||||
bool SupportsOnSeriesDelete { get; }
|
||||
bool SupportsOnEpisodeFileDelete { get; }
|
||||
bool SupportsOnEpisodeFileDeleteForUpgrade { get; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
|
@ -32,6 +32,11 @@ namespace NzbDrone.Core.Notifications.Join
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE_BRANDED, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -36,6 +36,13 @@ namespace NzbDrone.Core.Notifications.Mailgun
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, body, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
var body = $"{message.Message}";
|
||||
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, body, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
var body = $"{deleteMessage.Message}";
|
||||
|
|
|
@ -60,6 +60,19 @@ namespace NzbDrone.Core.Notifications.Emby
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
if (Settings.Notify)
|
||||
{
|
||||
_mediaBrowserService.Notify(Settings, SERIES_ADDED_TITLE_BRANDED, message.Message);
|
||||
}
|
||||
|
||||
if (Settings.UpdateLibrary)
|
||||
{
|
||||
_mediaBrowserService.Update(Settings, message.Series, "Created");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
if (Settings.Notify)
|
||||
|
|
|
@ -42,6 +42,11 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
|||
_proxy.SendNotification(BuildOnEpisodeFileDelete(deleteMessage), Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(BuildOnSeriesAdd(message), Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(BuildOnSeriesDelete(deleteMessage), Settings);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
@ -14,6 +13,7 @@ namespace NzbDrone.Core.Notifications
|
|||
protected const string EPISODE_GRABBED_TITLE = "Episode Grabbed";
|
||||
protected const string EPISODE_DOWNLOADED_TITLE = "Episode Downloaded";
|
||||
protected const string EPISODE_DELETED_TITLE = "Episode Deleted";
|
||||
protected const string SERIES_ADDED_TITLE = "Series Added";
|
||||
protected const string SERIES_DELETED_TITLE = "Series Deleted";
|
||||
protected const string HEALTH_ISSUE_TITLE = "Health Check Failure";
|
||||
protected const string APPLICATION_UPDATE_TITLE = "Application Updated";
|
||||
|
@ -21,6 +21,7 @@ namespace NzbDrone.Core.Notifications
|
|||
protected const string EPISODE_GRABBED_TITLE_BRANDED = "Sonarr - " + EPISODE_GRABBED_TITLE;
|
||||
protected const string EPISODE_DOWNLOADED_TITLE_BRANDED = "Sonarr - " + EPISODE_DOWNLOADED_TITLE;
|
||||
protected const string EPISODE_DELETED_TITLE_BRANDED = "Sonarr - " + EPISODE_DELETED_TITLE;
|
||||
protected const string SERIES_ADDED_TITLE_BRANDED = "Sonarr - " + SERIES_DELETED_TITLE;
|
||||
protected const string SERIES_DELETED_TITLE_BRANDED = "Sonarr - " + SERIES_DELETED_TITLE;
|
||||
protected const string HEALTH_ISSUE_TITLE_BRANDED = "Sonarr - " + HEALTH_ISSUE_TITLE;
|
||||
protected const string APPLICATION_UPDATE_TITLE_BRANDED = "Sonarr - " + APPLICATION_UPDATE_TITLE;
|
||||
|
@ -54,6 +55,10 @@ namespace NzbDrone.Core.Notifications
|
|||
{
|
||||
}
|
||||
|
||||
public virtual void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
}
|
||||
|
@ -74,6 +79,7 @@ namespace NzbDrone.Core.Notifications
|
|||
public bool SupportsOnRename => HasConcreteImplementation("OnRename");
|
||||
public bool SupportsOnDownload => HasConcreteImplementation("OnDownload");
|
||||
public bool SupportsOnUpgrade => SupportsOnDownload;
|
||||
public bool SupportsOnSeriesAdd => HasConcreteImplementation("OnSeriesAdd");
|
||||
public bool SupportsOnSeriesDelete => HasConcreteImplementation("OnSeriesDelete");
|
||||
public bool SupportsOnEpisodeFileDelete => HasConcreteImplementation("OnEpisodeFileDelete");
|
||||
public bool SupportsOnEpisodeFileDeleteForUpgrade => SupportsOnEpisodeFileDelete;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
namespace NzbDrone.Core.Notifications
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ namespace NzbDrone.Core.Notifications
|
|||
public bool OnDownload { get; set; }
|
||||
public bool OnUpgrade { get; set; }
|
||||
public bool OnRename { get; set; }
|
||||
public bool OnSeriesAdd { get; set; }
|
||||
public bool OnSeriesDelete { get; set; }
|
||||
public bool OnEpisodeFileDelete { get; set; }
|
||||
public bool OnEpisodeFileDeleteForUpgrade { get; set; }
|
||||
|
@ -17,6 +18,7 @@ namespace NzbDrone.Core.Notifications
|
|||
public bool SupportsOnDownload { get; set; }
|
||||
public bool SupportsOnUpgrade { get; set; }
|
||||
public bool SupportsOnRename { get; set; }
|
||||
public bool SupportsOnSeriesAdd { get; set; }
|
||||
public bool SupportsOnSeriesDelete { get; set; }
|
||||
public bool SupportsOnEpisodeFileDelete { get; set; }
|
||||
public bool SupportsOnEpisodeFileDeleteForUpgrade { get; set; }
|
||||
|
@ -24,6 +26,6 @@ namespace NzbDrone.Core.Notifications
|
|||
public bool IncludeHealthWarnings { get; set; }
|
||||
public bool SupportsOnApplicationUpdate { get; set; }
|
||||
|
||||
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnSeriesDelete || OnEpisodeFileDelete || OnEpisodeFileDeleteForUpgrade || OnHealthIssue || OnApplicationUpdate;
|
||||
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnSeriesAdd || OnSeriesDelete || OnEpisodeFileDelete || OnEpisodeFileDeleteForUpgrade || OnHealthIssue || OnApplicationUpdate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace NzbDrone.Core.Notifications
|
|||
List<INotification> OnDownloadEnabled();
|
||||
List<INotification> OnUpgradeEnabled();
|
||||
List<INotification> OnRenameEnabled();
|
||||
List<INotification> OnSeriesAddEnabled();
|
||||
List<INotification> OnSeriesDeleteEnabled();
|
||||
List<INotification> OnEpisodeFileDeleteEnabled();
|
||||
List<INotification> OnEpisodeFileDeleteForUpgradeEnabled();
|
||||
|
@ -48,6 +49,11 @@ namespace NzbDrone.Core.Notifications
|
|||
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
|
||||
}
|
||||
|
||||
public List<INotification> OnSeriesAddEnabled()
|
||||
{
|
||||
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnSeriesAdd).ToList();
|
||||
}
|
||||
|
||||
public List<INotification> OnSeriesDeleteEnabled()
|
||||
{
|
||||
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnSeriesDelete).ToList();
|
||||
|
@ -81,6 +87,7 @@ namespace NzbDrone.Core.Notifications
|
|||
definition.SupportsOnDownload = provider.SupportsOnDownload;
|
||||
definition.SupportsOnUpgrade = provider.SupportsOnUpgrade;
|
||||
definition.SupportsOnRename = provider.SupportsOnRename;
|
||||
definition.SupportsOnSeriesAdd = provider.SupportsOnSeriesAdd;
|
||||
definition.SupportsOnSeriesDelete = provider.SupportsOnSeriesDelete;
|
||||
definition.SupportsOnEpisodeFileDelete = provider.SupportsOnEpisodeFileDelete;
|
||||
definition.SupportsOnEpisodeFileDeleteForUpgrade = provider.SupportsOnEpisodeFileDeleteForUpgrade;
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace NzbDrone.Core.Notifications
|
|||
: IHandle<EpisodeGrabbedEvent>,
|
||||
IHandle<EpisodeImportedEvent>,
|
||||
IHandle<SeriesRenamedEvent>,
|
||||
IHandle<SeriesAddCompletedEvent>,
|
||||
IHandle<SeriesDeletedEvent>,
|
||||
IHandle<EpisodeFileDeletedEvent>,
|
||||
IHandle<HealthCheckFailedEvent>,
|
||||
|
@ -252,6 +253,31 @@ namespace NzbDrone.Core.Notifications
|
|||
}
|
||||
}
|
||||
|
||||
public void Handle(SeriesAddCompletedEvent message)
|
||||
{
|
||||
var series = message.Series;
|
||||
var addMessage = new SeriesAddMessage
|
||||
{
|
||||
Series = series,
|
||||
Message = series.Title
|
||||
};
|
||||
|
||||
foreach (var notification in _notificationFactory.OnSeriesAddEnabled())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ShouldHandleSeries(notification.Definition, series))
|
||||
{
|
||||
notification.OnSeriesAdd(addMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Unable to send OnDelete notification to: " + notification.Definition.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(SeriesDeletedEvent message)
|
||||
{
|
||||
foreach (var series in message.Series)
|
||||
|
|
|
@ -33,6 +33,11 @@ namespace NzbDrone.Core.Notifications.Ntfy
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -54,6 +54,11 @@ namespace NzbDrone.Core.Notifications.Plex.Server
|
|||
UpdateIfEnabled(deleteMessage.Series);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
UpdateIfEnabled(message.Series);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
if (deleteMessage.DeletedFiles)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
|
@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Prowl
|
|||
_prowlProxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_prowlProxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_prowlProxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -34,6 +34,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
|
@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Pushover
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
|
@ -34,6 +34,11 @@ namespace NzbDrone.Core.Notifications.SendGrid
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Notifications
|
||||
{
|
||||
public class SeriesAddMessage
|
||||
{
|
||||
public string Message { get; set; }
|
||||
public Series Series { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Message;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Simplepush
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -86,6 +86,21 @@ namespace NzbDrone.Core.Notifications.Slack
|
|||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
var attachments = new List<Attachment>
|
||||
{
|
||||
new Attachment
|
||||
{
|
||||
Title = message.Series.Title,
|
||||
}
|
||||
};
|
||||
|
||||
var payload = CreatePayload("Series Added", attachments);
|
||||
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
var attachments = new List<Attachment>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
@ -56,6 +56,14 @@ namespace NzbDrone.Core.Notifications.Synology
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
if (Settings.UpdateLibrary)
|
||||
{
|
||||
_indexerProxy.UpdateFolder(message.Series.Path);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
if (deleteMessage.DeletedFiles)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
|
@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Telegram
|
|||
_proxy.SendNotification(EPISODE_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_ADDED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(SERIES_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
|
|
@ -42,6 +42,12 @@ namespace NzbDrone.Core.Notifications.Trakt
|
|||
RemoveEpisodeFromCollection(Settings, deleteMessage.Series, deleteMessage.EpisodeFile);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
RefreshTokenIfNecessary();
|
||||
AddSeriesToCollection(Settings, message.Series);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
RefreshTokenIfNecessary();
|
||||
|
@ -234,6 +240,27 @@ namespace NzbDrone.Core.Notifications.Trakt
|
|||
_proxy.RemoveFromCollection(payload, settings.AccessToken);
|
||||
}
|
||||
|
||||
private void AddSeriesToCollection(TraktSettings settings, Series series)
|
||||
{
|
||||
var payload = new TraktCollectShowsResource
|
||||
{
|
||||
Shows = new List<TraktCollectShow>()
|
||||
};
|
||||
|
||||
payload.Shows.Add(new TraktCollectShow
|
||||
{
|
||||
Title = series.Title,
|
||||
Year = series.Year,
|
||||
Ids = new TraktShowIdsResource
|
||||
{
|
||||
Tvdb = series.TvdbId,
|
||||
Imdb = series.ImdbId ?? "",
|
||||
}
|
||||
});
|
||||
|
||||
_proxy.AddToCollection(payload, settings.AccessToken);
|
||||
}
|
||||
|
||||
private void RemoveSeriesFromCollection(TraktSettings settings, Series series)
|
||||
{
|
||||
var payload = new TraktCollectShowsResource
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
|
@ -33,6 +33,11 @@ namespace NzbDrone.Core.Notifications.Twitter
|
|||
_twitterService.SendNotification($"Episode Deleted: {deleteMessage.Message}", Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_twitterService.SendNotification($"Series Added: {message.Message}", Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_twitterService.SendNotification($"Series Deleted: {deleteMessage.Message}", Settings);
|
||||
|
|
|
@ -40,6 +40,11 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
_proxy.SendWebhook(BuildOnEpisodeFileDelete(deleteMessage), Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
_proxy.SendWebhook(BuildOnSeriesAdd(message), Settings);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendWebhook(BuildOnSeriesDelete(deleteMessage), Settings);
|
||||
|
|
|
@ -85,6 +85,17 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
};
|
||||
}
|
||||
|
||||
protected WebhookSeriesAddPayload BuildOnSeriesAdd(SeriesAddMessage addMessage)
|
||||
{
|
||||
return new WebhookSeriesAddPayload
|
||||
{
|
||||
EventType = WebhookEventType.SeriesAdd,
|
||||
InstanceName = _configFileProvider.InstanceName,
|
||||
ApplicationUrl = _configService.ApplicationUrl,
|
||||
Series = new WebhookSeries(addMessage.Series),
|
||||
};
|
||||
}
|
||||
|
||||
protected WebhookSeriesDeletePayload BuildOnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
return new WebhookSeriesDeletePayload
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
|
@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|||
Grab,
|
||||
Download,
|
||||
Rename,
|
||||
SeriesAdd,
|
||||
SeriesDelete,
|
||||
EpisodeFileDelete,
|
||||
Health,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public class WebhookSeriesAddPayload : WebhookPayload
|
||||
{
|
||||
public WebhookSeries Series { get; set; }
|
||||
}
|
||||
}
|
|
@ -50,6 +50,14 @@ namespace NzbDrone.Core.Notifications.Xbmc
|
|||
UpdateAndClean(deleteMessage.Series, true);
|
||||
}
|
||||
|
||||
public override void OnSeriesAdd(SeriesAddMessage message)
|
||||
{
|
||||
const string header = "Sonarr - Added";
|
||||
|
||||
Notify(Settings, header, message.Message);
|
||||
UpdateAndClean(message.Series, true);
|
||||
}
|
||||
|
||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||
{
|
||||
if (deleteMessage.DeletedFiles)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.Tv.Events
|
||||
{
|
||||
public class SeriesAddCompletedEvent : IEvent
|
||||
{
|
||||
public Series Series { get; private set; }
|
||||
|
||||
public SeriesAddCompletedEvent(Series series)
|
||||
{
|
||||
Series = series;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
using NLog;
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
{
|
||||
|
@ -13,6 +14,7 @@ namespace NzbDrone.Core.Tv
|
|||
private readonly ISeriesService _seriesService;
|
||||
private readonly IManageCommandQueue _commandQueueManager;
|
||||
private readonly IEpisodeAddedService _episodeAddedService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
|
||||
private readonly Logger _logger;
|
||||
|
||||
|
@ -20,12 +22,14 @@ namespace NzbDrone.Core.Tv
|
|||
ISeriesService seriesService,
|
||||
IManageCommandQueue commandQueueManager,
|
||||
IEpisodeAddedService episodeAddedService,
|
||||
IEventAggregator eventAggregator,
|
||||
Logger logger)
|
||||
{
|
||||
_episodeMonitoredService = episodeMonitoredService;
|
||||
_seriesService = seriesService;
|
||||
_commandQueueManager = commandQueueManager;
|
||||
_episodeAddedService = episodeAddedService;
|
||||
_eventAggregator = eventAggregator;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -42,6 +46,8 @@ namespace NzbDrone.Core.Tv
|
|||
_logger.Info("[{0}] was recently added, performing post-add actions", series.Title);
|
||||
_episodeMonitoredService.SetEpisodeMonitoredStatus(series, addOptions);
|
||||
|
||||
_eventAggregator.PublishEvent(new SeriesAddCompletedEvent(series));
|
||||
|
||||
// If both options are enabled search for the whole series, which will only include monitored episodes.
|
||||
// This way multiple searches for the same season are skipped, though a season that can't be upgraded may be
|
||||
// searched, but the logs will be more explicit.
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
public bool OnDownload { get; set; }
|
||||
public bool OnUpgrade { get; set; }
|
||||
public bool OnRename { get; set; }
|
||||
public bool OnSeriesAdd { get; set; }
|
||||
public bool OnSeriesDelete { get; set; }
|
||||
public bool OnEpisodeFileDelete { get; set; }
|
||||
public bool OnEpisodeFileDeleteForUpgrade { get; set; }
|
||||
|
@ -18,6 +19,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
public bool SupportsOnDownload { get; set; }
|
||||
public bool SupportsOnUpgrade { get; set; }
|
||||
public bool SupportsOnRename { get; set; }
|
||||
public bool SupportsOnSeriesAdd { get; set; }
|
||||
public bool SupportsOnSeriesDelete { get; set; }
|
||||
public bool SupportsOnEpisodeFileDelete { get; set; }
|
||||
public bool SupportsOnEpisodeFileDeleteForUpgrade { get; set; }
|
||||
|
@ -42,6 +44,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
resource.OnDownload = definition.OnDownload;
|
||||
resource.OnUpgrade = definition.OnUpgrade;
|
||||
resource.OnRename = definition.OnRename;
|
||||
resource.OnSeriesAdd = definition.OnSeriesAdd;
|
||||
resource.OnSeriesDelete = definition.OnSeriesDelete;
|
||||
resource.OnEpisodeFileDelete = definition.OnEpisodeFileDelete;
|
||||
resource.OnEpisodeFileDeleteForUpgrade = definition.OnEpisodeFileDeleteForUpgrade;
|
||||
|
@ -51,6 +54,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
resource.SupportsOnDownload = definition.SupportsOnDownload;
|
||||
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
|
||||
resource.SupportsOnRename = definition.SupportsOnRename;
|
||||
resource.SupportsOnSeriesAdd = definition.SupportsOnSeriesAdd;
|
||||
resource.SupportsOnSeriesDelete = definition.SupportsOnSeriesDelete;
|
||||
resource.SupportsOnEpisodeFileDelete = definition.SupportsOnEpisodeFileDelete;
|
||||
resource.SupportsOnEpisodeFileDeleteForUpgrade = definition.SupportsOnEpisodeFileDeleteForUpgrade;
|
||||
|
@ -74,6 +78,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
definition.OnDownload = resource.OnDownload;
|
||||
definition.OnUpgrade = resource.OnUpgrade;
|
||||
definition.OnRename = resource.OnRename;
|
||||
definition.OnSeriesAdd = resource.OnSeriesAdd;
|
||||
definition.OnSeriesDelete = resource.OnSeriesDelete;
|
||||
definition.OnEpisodeFileDelete = resource.OnEpisodeFileDelete;
|
||||
definition.OnEpisodeFileDeleteForUpgrade = resource.OnEpisodeFileDeleteForUpgrade;
|
||||
|
@ -83,6 +88,7 @@ namespace Sonarr.Api.V3.Notifications
|
|||
definition.SupportsOnDownload = resource.SupportsOnDownload;
|
||||
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
|
||||
definition.SupportsOnRename = resource.SupportsOnRename;
|
||||
definition.SupportsOnSeriesAdd = resource.SupportsOnSeriesAdd;
|
||||
definition.SupportsOnSeriesDelete = resource.SupportsOnSeriesDelete;
|
||||
definition.SupportsOnEpisodeFileDelete = resource.SupportsOnEpisodeFileDelete;
|
||||
definition.SupportsOnEpisodeFileDeleteForUpgrade = resource.SupportsOnEpisodeFileDeleteForUpgrade;
|
||||
|
|
Loading…
Reference in New Issue