diff --git a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs index ef7de07a1..fd238b7f5 100644 --- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs +++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs @@ -19,11 +19,11 @@ public override string Link get { return "https://boxcar.io/client"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _proxy.SendNotification(title, message, Settings); + _proxy.SendNotification(title, grabMessage.Message, Settings); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs index f1389e146..b5e893076 100644 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs @@ -18,7 +18,7 @@ public override string Link get { return "https://github.com/Sonarr/Sonarr/wiki/Custom-Post-Processing-Scripts"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { } diff --git a/src/NzbDrone.Core/Notifications/Email/Email.cs b/src/NzbDrone.Core/Notifications/Email/Email.cs index 6bdf017c4..da265305d 100644 --- a/src/NzbDrone.Core/Notifications/Email/Email.cs +++ b/src/NzbDrone.Core/Notifications/Email/Email.cs @@ -20,10 +20,10 @@ public override string Link get { return null; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string subject = "Sonarr [TV] - Grabbed"; - var body = String.Format("{0} sent to queue.", message); + var body = String.Format("{0} sent to queue.", grabMessage.Message); _emailService.SendEmail(Settings, subject, body); } diff --git a/src/NzbDrone.Core/Notifications/GrabMessage.cs b/src/NzbDrone.Core/Notifications/GrabMessage.cs new file mode 100644 index 000000000..13c287468 --- /dev/null +++ b/src/NzbDrone.Core/Notifications/GrabMessage.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Core.MediaFiles; +using NzbDrone.Core.Parser.Model; +using NzbDrone.Core.Qualities; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Core.Notifications +{ + public class GrabMessage + { + public String Message { get; set; } + public Series Series { get; set; } + public RemoteEpisode Episode { get; set; } + public QualityModel Quality { get; set; } + + public override string ToString() + { + return Message; + } + } +} diff --git a/src/NzbDrone.Core/Notifications/Growl/Growl.cs b/src/NzbDrone.Core/Notifications/Growl/Growl.cs index 1b2ff1e29..c2bf31fa5 100644 --- a/src/NzbDrone.Core/Notifications/Growl/Growl.cs +++ b/src/NzbDrone.Core/Notifications/Growl/Growl.cs @@ -19,11 +19,11 @@ public override string Link get { return "http://growl.info/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _growlService.SendNotification(title, message, "GRAB", Settings.Host, Settings.Port, Settings.Password); + _growlService.SendNotification(title, grabMessage.Message, "GRAB", Settings.Host, Settings.Port, Settings.Password); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/INotification.cs b/src/NzbDrone.Core/Notifications/INotification.cs index 700237d1c..7c4e105b9 100644 --- a/src/NzbDrone.Core/Notifications/INotification.cs +++ b/src/NzbDrone.Core/Notifications/INotification.cs @@ -7,7 +7,7 @@ public interface INotification : IProvider { string Link { get; } - void OnGrab(string message); + void OnGrab(GrabMessage grabMessage); void OnDownload(DownloadMessage message); void OnRename(Series series); bool SupportsOnGrab { get; } diff --git a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowser.cs b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowser.cs index 590943fd1..7102da090 100644 --- a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowser.cs +++ b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowser.cs @@ -20,13 +20,13 @@ public override string Link get { return "http://mediabrowser.tv/"; } } - public override void OnGrab(String message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Sonarr - Grabbed"; if (Settings.Notify) { - _mediaBrowserService.Notify(Settings, title, message); + _mediaBrowserService.Notify(Settings, title, grabMessage.Message); } } diff --git a/src/NzbDrone.Core/Notifications/NotificationBase.cs b/src/NzbDrone.Core/Notifications/NotificationBase.cs index 469f6cafa..255f5f1e0 100644 --- a/src/NzbDrone.Core/Notifications/NotificationBase.cs +++ b/src/NzbDrone.Core/Notifications/NotificationBase.cs @@ -39,7 +39,7 @@ public IEnumerable DefaultDefinitions public abstract string Link { get; } - public abstract void OnGrab(string message); + public abstract void OnGrab(GrabMessage grabMessage); public abstract void OnDownload(DownloadMessage message); public abstract void OnRename(Series series); diff --git a/src/NzbDrone.Core/Notifications/NotificationService.cs b/src/NzbDrone.Core/Notifications/NotificationService.cs index 94cbdb4e0..e7e44504f 100644 --- a/src/NzbDrone.Core/Notifications/NotificationService.cs +++ b/src/NzbDrone.Core/Notifications/NotificationService.cs @@ -90,14 +90,19 @@ private bool ShouldHandleSeries(ProviderDefinition definition, Series series) public void Handle(EpisodeGrabbedEvent message) { - var messageBody = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality); + var grabMessage = new GrabMessage { + Message = GetMessage(message.Episode.Series, message.Episode.Episodes, message.Episode.ParsedEpisodeInfo.Quality), + Series = message.Episode.Series, + Quality = message.Episode.ParsedEpisodeInfo.Quality, + Episode = message.Episode + }; foreach (var notification in _notificationFactory.OnGrabEnabled()) { try { if (!ShouldHandleSeries(notification.Definition, message.Episode.Series)) continue; - notification.OnGrab(messageBody); + notification.OnGrab(grabMessage); } catch (Exception ex) diff --git a/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs index c4a346bee..3d4a7f813 100644 --- a/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs +++ b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs @@ -20,11 +20,11 @@ public override string Link get { return "http://www.notifymyandroid.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _proxy.SendNotification(title, message, Settings.ApiKey, (NotifyMyAndroidPriority)Settings.Priority); + _proxy.SendNotification(title, grabMessage.Message, Settings.ApiKey, (NotifyMyAndroidPriority)Settings.Priority); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs b/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs index 927532663..3b5a25b6d 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs @@ -19,10 +19,10 @@ public override string Link get { return "http://www.plexapp.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string header = "Sonarr [TV] - Grabbed"; - _plexClientService.Notify(Settings, header, message); + _plexClientService.Notify(Settings, header, grabMessage.Message); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheater.cs b/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheater.cs index fbf056ab1..e5df63a87 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheater.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheater.cs @@ -25,11 +25,11 @@ public override string Link get { return "https://plex.tv/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string header = "Sonarr - Grabbed"; - Notify(Settings, header, message); + Notify(Settings, header, grabMessage.Message); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexServer.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServer.cs index 4d73dfd3b..cf7f7acd8 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexServer.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexServer.cs @@ -19,7 +19,7 @@ public override string Link get { return "http://www.plexapp.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { } diff --git a/src/NzbDrone.Core/Notifications/Prowl/Prowl.cs b/src/NzbDrone.Core/Notifications/Prowl/Prowl.cs index c52f4d370..fe31abace 100644 --- a/src/NzbDrone.Core/Notifications/Prowl/Prowl.cs +++ b/src/NzbDrone.Core/Notifications/Prowl/Prowl.cs @@ -20,11 +20,11 @@ public override string Link get { return "http://www.prowlapp.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _prowlService.SendNotification(title, message, Settings.ApiKey, (NotificationPriority)Settings.Priority); + _prowlService.SendNotification(title, grabMessage.Message, Settings.ApiKey, (NotificationPriority)Settings.Priority); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs index d127583f4..ec2c997ac 100644 --- a/src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs +++ b/src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs @@ -19,11 +19,11 @@ public override string Link get { return "https://www.pushbullet.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Sonarr - Episode Grabbed"; - _proxy.SendNotification(title, message, Settings); + _proxy.SendNotification(title, grabMessage.Message, Settings); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Pushalot/Pushalot.cs b/src/NzbDrone.Core/Notifications/Pushalot/Pushalot.cs index 8649e5ee5..67484a92d 100644 --- a/src/NzbDrone.Core/Notifications/Pushalot/Pushalot.cs +++ b/src/NzbDrone.Core/Notifications/Pushalot/Pushalot.cs @@ -20,11 +20,11 @@ public override string Link get { return "https://www.Pushalot.com/"; } } - public override void OnGrab(String message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _proxy.SendNotification(title, message, Settings); + _proxy.SendNotification(title, grabMessage.Message, Settings); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs b/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs index 9f5ae7c2b..d6211504f 100644 --- a/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs +++ b/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs @@ -19,11 +19,11 @@ public override string Link get { return "https://pushover.net/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string title = "Episode Grabbed"; - _proxy.SendNotification(title, message, Settings.ApiKey, Settings.UserKey, (PushoverPriority)Settings.Priority, Settings.Sound); + _proxy.SendNotification(title, grabMessage.Message, Settings.ApiKey, Settings.UserKey, (PushoverPriority)Settings.Priority, Settings.Sound); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Synology/SynologyIndexer.cs b/src/NzbDrone.Core/Notifications/Synology/SynologyIndexer.cs index 045112bbe..150dfa67e 100644 --- a/src/NzbDrone.Core/Notifications/Synology/SynologyIndexer.cs +++ b/src/NzbDrone.Core/Notifications/Synology/SynologyIndexer.cs @@ -21,7 +21,7 @@ public override string Link get { return "http://www.synology.com"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { } diff --git a/src/NzbDrone.Core/Notifications/Twitter/Twitter.cs b/src/NzbDrone.Core/Notifications/Twitter/Twitter.cs index a6ef406c6..4f3c9a3aa 100644 --- a/src/NzbDrone.Core/Notifications/Twitter/Twitter.cs +++ b/src/NzbDrone.Core/Notifications/Twitter/Twitter.cs @@ -20,9 +20,9 @@ public override string Link get { return "https://twitter.com/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { - _twitterService.SendNotification(message, Settings); + _twitterService.SendNotification(grabMessage.Message, Settings); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs b/src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs index cd9aa4a11..08602b8d4 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs @@ -25,11 +25,11 @@ public override string Link get { return "http://xbmc.org/"; } } - public override void OnGrab(string message) + public override void OnGrab(GrabMessage grabMessage) { const string header = "Sonarr - Grabbed"; - Notify(Settings, header, message); + Notify(Settings, header, grabMessage.Message); } public override void OnDownload(DownloadMessage message) diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index be79e3c29..19949d436 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -728,6 +728,7 @@ +