New: Movie Added Notification

pull/7333/head
Qstick 2 years ago
parent a8695959f1
commit f890aadffa

@ -59,6 +59,7 @@ class Notification extends Component {
onDownload,
onUpgrade,
onRename,
onMovieAdded,
onMovieDelete,
onMovieFileDelete,
onMovieFileDeleteForUpgrade,
@ -68,6 +69,7 @@ class Notification extends Component {
supportsOnDownload,
supportsOnUpgrade,
supportsOnRename,
supportsOnMovieAdded,
supportsOnMovieDelete,
supportsOnMovieFileDelete,
supportsOnMovieFileDeleteForUpgrade,
@ -117,6 +119,14 @@ class Notification extends Component {
null
}
{
supportsOnMovieAdded && onMovieAdded ?
<Label kind={kinds.SUCCESS}>
{translate('OnMovieAdded')}
</Label> :
null
}
{
supportsOnHealthIssue && onHealthIssue ?
<Label kind={kinds.SUCCESS}>
@ -196,6 +206,7 @@ Notification.propTypes = {
onDownload: PropTypes.bool.isRequired,
onUpgrade: PropTypes.bool.isRequired,
onRename: PropTypes.bool.isRequired,
onMovieAdded: PropTypes.bool.isRequired,
onMovieDelete: PropTypes.bool.isRequired,
onMovieFileDelete: PropTypes.bool.isRequired,
onMovieFileDeleteForUpgrade: PropTypes.bool.isRequired,
@ -208,6 +219,7 @@ Notification.propTypes = {
supportsOnMovieFileDeleteForUpgrade: PropTypes.bool.isRequired,
supportsOnUpgrade: PropTypes.bool.isRequired,
supportsOnRename: PropTypes.bool.isRequired,
supportsOnMovieAdded: PropTypes.bool.isRequired,
supportsOnHealthIssue: PropTypes.bool.isRequired,
supportsOnApplicationUpdate: PropTypes.bool.isRequired,
onConfirmDeleteNotification: PropTypes.func.isRequired

@ -19,6 +19,7 @@ function NotificationEventItems(props) {
onDownload,
onUpgrade,
onRename,
onMovieAdded,
onMovieDelete,
onMovieFileDelete,
onMovieFileDeleteForUpgrade,
@ -28,6 +29,7 @@ function NotificationEventItems(props) {
supportsOnDownload,
supportsOnUpgrade,
supportsOnRename,
supportsOnMovieAdded,
supportsOnMovieDelete,
supportsOnMovieFileDelete,
supportsOnMovieFileDeleteForUpgrade,
@ -92,6 +94,17 @@ function NotificationEventItems(props) {
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onMovieAdded"
helpText={translate('OnMovieAddedHelpText')}
isDisabled={!supportsOnMovieAdded.value}
{...onMovieAdded}
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.onMovieAdded = selectedSchema.supportsOnMovieAdded;
selectedSchema.onMovieDelete = selectedSchema.supportsOnMovieDelete;
selectedSchema.onMovieFileDelete = selectedSchema.supportsOnMovieFileDelete;
selectedSchema.onMovieFileDeleteForUpgrade = selectedSchema.supportsOnMovieFileDeleteForUpgrade;

@ -64,6 +64,11 @@ namespace NzbDrone.Core.Test.NotificationTests
TestLogger.Info("OnRename was called");
}
public override void OnMovieAdded(Movie movie)
{
TestLogger.Info("OnMovieAdded was called");
}
public override void OnMovieFileDelete(MovieFileDeleteMessage message)
{
TestLogger.Info("OnMovieFileDelete was called");
@ -117,6 +122,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnDownload.Should().BeTrue();
notification.SupportsOnUpgrade.Should().BeTrue();
notification.SupportsOnRename.Should().BeTrue();
notification.SupportsOnMovieAdded.Should().BeTrue();
notification.SupportsOnMovieDelete.Should().BeTrue();
notification.SupportsOnMovieFileDelete.Should().BeTrue();
notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeTrue();
@ -133,6 +139,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnDownload.Should().BeFalse();
notification.SupportsOnUpgrade.Should().BeFalse();
notification.SupportsOnRename.Should().BeFalse();
notification.SupportsOnMovieAdded.Should().BeFalse();
notification.SupportsOnMovieDelete.Should().BeFalse();
notification.SupportsOnMovieFileDelete.Should().BeFalse();
notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeFalse();

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(210)]
public class movie_added_notifications : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnMovieAdded").AsBoolean().WithDefaultValue(false);
}
}
}

@ -88,6 +88,7 @@ namespace NzbDrone.Core.Datastore
.Ignore(i => i.SupportsOnDownload)
.Ignore(i => i.SupportsOnUpgrade)
.Ignore(i => i.SupportsOnRename)
.Ignore(i => i.SupportsOnMovieAdded)
.Ignore(i => i.SupportsOnMovieDelete)
.Ignore(i => i.SupportsOnMovieFileDelete)
.Ignore(i => i.SupportsOnMovieFileDeleteForUpgrade)

@ -107,7 +107,8 @@ namespace NzbDrone.Core.ImportLists
AddOptions = new AddMovieOptions
{
SearchForMovie = monitorType != MonitorTypes.None && importList.SearchOnAdd,
Monitor = monitorType
Monitor = monitorType,
AddMethod = AddMovieMethod.List
}
});
}

@ -648,6 +648,8 @@
"OnLatestVersion": "The latest version of Radarr is already installed",
"OnlyTorrent": "Only Torrent",
"OnlyUsenet": "Only Usenet",
"OnMovieAdded": "On Movie Added",
"OnMovieAddedHelpText": "On Movie Added",
"OnMovieDelete": "On Movie Delete",
"OnMovieDeleteHelpText": "On Movie Delete",
"OnMovieFileDelete": "On Movie File Delete",

@ -3,5 +3,13 @@ namespace NzbDrone.Core.Movies
public class AddMovieOptions : MonitoringOptions
{
public bool SearchForMovie { get; set; }
public AddMovieMethod AddMethod { get; set; }
}
public enum AddMovieMethod
{
Manual,
List,
Collection
}
}

@ -109,7 +109,8 @@ namespace NzbDrone.Core.Movies
MinimumAvailability = collection.MinimumAvailability,
AddOptions = new AddMovieOptions
{
SearchForMovie = collection.SearchOnAdd
SearchForMovie = collection.SearchOnAdd,
AddMethod = AddMovieMethod.Collection
},
Monitored = true
}).ToList());

@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Boxcar
{
@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE_BRANDED, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -125,6 +125,22 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
public override void OnMovieAdded(Movie movie)
{
var environmentVariables = new StringDictionary();
environmentVariables.Add("Radarr_EventType", "MovieAdded");
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
environmentVariables.Add("Radarr_Movie_Title", movie.MovieMetadata.Value.Title);
environmentVariables.Add("Radarr_Movie_Year", movie.MovieMetadata.Value.Year.ToString());
environmentVariables.Add("Radarr_Movie_Path", movie.Path);
environmentVariables.Add("Radarr_Movie_ImdbId", movie.MovieMetadata.Value.ImdbId ?? string.Empty);
environmentVariables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString());
environmentVariables.Add("Radarr_Movie_AddMethod", movie.AddOptions.AddMethod.ToString());
ExecuteScript(environmentVariables);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;

@ -8,6 +8,7 @@ using MimeKit;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http.Dispatchers;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Email
{
@ -40,6 +41,13 @@ namespace NzbDrone.Core.Notifications.Email
SendEmail(Settings, MOVIE_DOWNLOADED_TITLE_BRANDED, body);
}
public override void OnMovieAdded(Movie movie)
{
var body = $"{movie.Title} added to library.";
SendEmail(Settings, MOVIE_ADDED_TITLE_BRANDED, body);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var body = $"{deleteMessage.Message} deleted.";

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using FluentValidation.Results;
using NLog;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Gotify
{
@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.Gotify
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Notifications
void OnMovieRename(Movie movie, List<RenamedMovieFile> renamedFiles);
void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage);
void OnMovieDelete(MovieDeleteMessage deleteMessage);
void OnMovieAdded(Movie movie);
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnApplicationUpdate(ApplicationUpdateMessage updateMessage);
void ProcessQueue();
@ -21,6 +22,7 @@ namespace NzbDrone.Core.Notifications
bool SupportsOnDownload { get; }
bool SupportsOnUpgrade { get; }
bool SupportsOnRename { get; }
bool SupportsOnMovieAdded { get; }
bool SupportsOnMovieDelete { get; }
bool SupportsOnMovieFileDelete { get; }
bool SupportsOnMovieFileDeleteForUpgrade { get; }

@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Join
{
@ -27,6 +28,11 @@ namespace NzbDrone.Core.Notifications.Join
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE_BRANDED, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using FluentValidation.Results;
using NLog;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Mailgun
{
@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.Mailgun
_proxy.SendNotification(downloadMessage.OldMovieFiles.Count > 0 ? MOVIE_UPGRADED_TITLE : MOVIE_DOWNLOADED_TITLE, downloadMessage.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var body = $"{deleteMessage.Message} deleted.";

@ -6,6 +6,7 @@ using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Notifiarr
{
@ -116,6 +117,22 @@ namespace NzbDrone.Core.Notifications.Notifiarr
_proxy.SendNotification(variables, Settings);
}
public override void OnMovieAdded(Movie movie)
{
var variables = new StringDictionary();
variables.Add("Radarr_EventType", "MovieAdded");
variables.Add("Radarr_Movie_Id", movie.Id.ToString());
variables.Add("Radarr_Movie_Title", movie.MovieMetadata.Value.Title);
variables.Add("Radarr_Movie_Year", movie.MovieMetadata.Value.Year.ToString());
variables.Add("Radarr_Movie_Path", movie.Path);
variables.Add("Radarr_Movie_ImdbId", movie.MovieMetadata.Value.ImdbId ?? string.Empty);
variables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString());
variables.Add("Radarr_Movie_AddMethod", movie.AddOptions.AddMethod.ToString());
_proxy.SendNotification(variables, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;

@ -13,12 +13,14 @@ namespace NzbDrone.Core.Notifications
protected const string MOVIE_GRABBED_TITLE = "Movie Grabbed";
protected const string MOVIE_DOWNLOADED_TITLE = "Movie Downloaded";
protected const string MOVIE_UPGRADED_TITLE = "Movie Upgraded";
protected const string MOVIE_ADDED_TITLE = "Movie Added";
protected const string MOVIE_DELETED_TITLE = "Movie Deleted";
protected const string MOVIE_FILE_DELETED_TITLE = "Movie File Deleted";
protected const string HEALTH_ISSUE_TITLE = "Health Check Failure";
protected const string APPLICATION_UPDATE_TITLE = "Application Updated";
protected const string MOVIE_GRABBED_TITLE_BRANDED = "Radarr - " + MOVIE_GRABBED_TITLE;
protected const string MOVIE_ADDED_TITLE_BRANDED = "Radarr - " + MOVIE_ADDED_TITLE;
protected const string MOVIE_DOWNLOADED_TITLE_BRANDED = "Radarr - " + MOVIE_DOWNLOADED_TITLE;
protected const string MOVIE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_DELETED_TITLE;
protected const string MOVIE_FILE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_FILE_DELETED_TITLE;
@ -50,6 +52,10 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnMovieAdded(Movie movie)
{
}
public virtual void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
}
@ -74,6 +80,7 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnRename => HasConcreteImplementation("OnMovieRename");
public bool SupportsOnDownload => HasConcreteImplementation("OnDownload");
public bool SupportsOnUpgrade => SupportsOnDownload;
public bool SupportsOnMovieAdded => HasConcreteImplementation("OnMovieAdded");
public bool SupportsOnMovieDelete => HasConcreteImplementation("OnMovieDelete");
public bool SupportsOnMovieFileDelete => HasConcreteImplementation("OnMovieFileDelete");
public bool SupportsOnMovieFileDeleteForUpgrade => SupportsOnMovieFileDelete;

@ -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 OnMovieAdded { get; set; }
public bool OnMovieDelete { get; set; }
public bool OnMovieFileDelete { get; set; }
public bool OnMovieFileDeleteForUpgrade { 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 SupportsOnMovieAdded { get; set; }
public bool SupportsOnMovieDelete { get; set; }
public bool SupportsOnMovieFileDelete { get; set; }
public bool SupportsOnMovieFileDeleteForUpgrade { 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) || OnMovieDelete || OnMovieFileDelete || OnMovieFileDeleteForUpgrade || OnHealthIssue || OnApplicationUpdate;
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnMovieAdded || OnMovieDelete || OnMovieFileDelete || OnMovieFileDeleteForUpgrade || OnHealthIssue || OnApplicationUpdate;
}
}

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnDownloadEnabled();
List<INotification> OnUpgradeEnabled();
List<INotification> OnRenameEnabled();
List<INotification> OnMovieAddedEnabled();
List<INotification> OnMovieDeleteEnabled();
List<INotification> OnMovieFileDeleteEnabled();
List<INotification> OnHealthIssueEnabled();
@ -46,6 +47,11 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
}
public List<INotification> OnMovieAddedEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnMovieAdded).ToList();
}
public List<INotification> OnMovieDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnMovieDelete).ToList();

@ -19,6 +19,7 @@ namespace NzbDrone.Core.Notifications
IHandle<MovieGrabbedEvent>,
IHandle<MovieImportedEvent>,
IHandle<MoviesDeletedEvent>,
IHandle<MovieAddedEvent>,
IHandle<MovieFileDeletedEvent>,
IHandle<HealthCheckFailedEvent>,
IHandle<UpdateInstalledEvent>,
@ -155,6 +156,24 @@ namespace NzbDrone.Core.Notifications
}
}
public void Handle(MovieAddedEvent message)
{
foreach (var notification in _notificationFactory.OnMovieAddedEnabled())
{
try
{
if (ShouldHandleMovie(notification.Definition, message.Movie))
{
notification.OnMovieAdded(message.Movie);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnMovieAdded notification to: " + notification.Definition.Name);
}
}
}
public void Handle(MovieRenamedEvent message)
{
foreach (var notification in _notificationFactory.OnRenameEnabled())

@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Prowl
{
@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Prowl
_prowlProxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_prowlProxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Notifications.PushBullet
@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE_BRANDED, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Pushover
{
@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Pushover
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using FluentValidation.Results;
using NLog;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.SendGrid
{
@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.SendGrid
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Simplepush
{
@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Simplepush
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Telegram
{
@ -34,6 +35,11 @@ namespace NzbDrone.Core.Notifications.Telegram
}
}
public override void OnMovieAdded(Movie movie)
{
_proxy.SendNotification(MOVIE_ADDED_TITLE, $"{movie.Title} added to library", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);

@ -2,6 +2,7 @@ using System.Collections.Generic;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Notifications.Twitter
@ -28,6 +29,11 @@ namespace NzbDrone.Core.Notifications.Twitter
_twitterService.SendNotification($"[Radarr] Imported: {message.Message}", Settings);
}
public override void OnMovieAdded(Movie movie)
{
_twitterService.SendNotification($"[Radarr] Added: {movie.Title}", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Movie File Deleted: {deleteMessage.Message}", Settings);

@ -79,6 +79,17 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(payload, Settings);
}
public override void OnMovieAdded(Movie movie)
{
var payload = new WebhookRenamePayload
{
EventType = WebhookEventType.MovieAdded,
Movie = new WebhookMovie(movie)
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var payload = new WebhookMovieFileDeletePayload

@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookAddedPayload : WebhookPayload
{
public WebhookMovie Movie { get; set; }
}
}

@ -15,6 +15,7 @@ namespace NzbDrone.Core.Notifications.Webhook
MovieDelete,
MovieFileDelete,
Health,
ApplicationUpdate
ApplicationUpdate,
MovieAdded
}
}

@ -9,6 +9,7 @@ namespace Radarr.Api.V3.Notifications
public bool OnDownload { get; set; }
public bool OnUpgrade { get; set; }
public bool OnRename { get; set; }
public bool OnMovieAdded { get; set; }
public bool OnMovieDelete { get; set; }
public bool OnMovieFileDelete { get; set; }
public bool OnMovieFileDeleteForUpgrade { get; set; }
@ -18,6 +19,7 @@ namespace Radarr.Api.V3.Notifications
public bool SupportsOnDownload { get; set; }
public bool SupportsOnUpgrade { get; set; }
public bool SupportsOnRename { get; set; }
public bool SupportsOnMovieAdded { get; set; }
public bool SupportsOnMovieDelete { get; set; }
public bool SupportsOnMovieFileDelete { get; set; }
public bool SupportsOnMovieFileDeleteForUpgrade { get; set; }
@ -42,6 +44,7 @@ namespace Radarr.Api.V3.Notifications
resource.OnDownload = definition.OnDownload;
resource.OnUpgrade = definition.OnUpgrade;
resource.OnRename = definition.OnRename;
resource.OnMovieAdded = definition.OnMovieAdded;
resource.OnMovieDelete = definition.OnMovieDelete;
resource.OnMovieFileDelete = definition.OnMovieFileDelete;
resource.OnMovieFileDeleteForUpgrade = definition.OnMovieFileDeleteForUpgrade;
@ -51,6 +54,7 @@ namespace Radarr.Api.V3.Notifications
resource.SupportsOnDownload = definition.SupportsOnDownload;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
resource.SupportsOnRename = definition.SupportsOnRename;
resource.SupportsOnMovieAdded = definition.SupportsOnMovieAdded;
resource.SupportsOnMovieDelete = definition.SupportsOnMovieDelete;
resource.SupportsOnMovieFileDelete = definition.SupportsOnMovieFileDelete;
resource.SupportsOnMovieFileDeleteForUpgrade = definition.SupportsOnMovieFileDeleteForUpgrade;
@ -74,6 +78,7 @@ namespace Radarr.Api.V3.Notifications
definition.OnDownload = resource.OnDownload;
definition.OnUpgrade = resource.OnUpgrade;
definition.OnRename = resource.OnRename;
definition.OnMovieAdded = resource.OnMovieAdded;
definition.OnMovieDelete = resource.OnMovieDelete;
definition.OnMovieFileDelete = resource.OnMovieFileDelete;
definition.OnMovieFileDeleteForUpgrade = resource.OnMovieFileDeleteForUpgrade;
@ -83,6 +88,7 @@ namespace Radarr.Api.V3.Notifications
definition.SupportsOnDownload = resource.SupportsOnDownload;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
definition.SupportsOnRename = resource.SupportsOnRename;
definition.SupportsOnMovieAdded = resource.SupportsOnMovieAdded;
definition.SupportsOnMovieDelete = resource.SupportsOnMovieDelete;
definition.SupportsOnMovieFileDelete = resource.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = resource.SupportsOnMovieFileDeleteForUpgrade;

Loading…
Cancel
Save