From 66bce4b51eadc766ed54aa8810092df7c954180e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 4 Jun 2013 19:15:39 -0700 Subject: [PATCH] Notifications have real messages now --- .../Notifications/NotificationService.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/NzbDrone.Core/Notifications/NotificationService.cs b/NzbDrone.Core/Notifications/NotificationService.cs index d2591714d..9f08f90c8 100644 --- a/NzbDrone.Core/Notifications/NotificationService.cs +++ b/NzbDrone.Core/Notifications/NotificationService.cs @@ -9,6 +9,7 @@ using NzbDrone.Common.Serializer; using NzbDrone.Core.Download; using NzbDrone.Core.MediaFiles.Events; +using NzbDrone.Core.Parser.Model; using Omu.ValueInjecter; namespace NzbDrone.Core.Notifications @@ -133,13 +134,21 @@ private INotification GetInstance(NotificationDefinition indexerDefinition) return instance; } + private string GetMessage(ParsedEpisodeInfo parsedEpisodeInfo) + { + return String.Format("{0} - {1}{2}", + parsedEpisodeInfo.SeriesTitle, + parsedEpisodeInfo.SeasonNumber, + String.Concat(parsedEpisodeInfo.EpisodeNumbers.Select(i => String.Format("x{0:00}", i)))); + } + public void Handle(EpisodeGrabbedEvent message) { All().Where(n => n.OnGrab) .ToList() .ForEach(notification => notification.Instance - .OnGrab("Grabbed!") + .OnGrab(GetMessage(message.Episode.ParsedEpisodeInfo)) ); } @@ -149,7 +158,7 @@ public void Handle(EpisodeDownloadedEvent message) .ToList() .ForEach(notification => notification.Instance - .OnDownload("Downloaded!", message.Series) + .OnDownload(GetMessage(message.ParsedEpisodeInfo), message.Series) ); } @@ -159,7 +168,7 @@ public void Handle(SeriesRenamedEvent message) .ToList() .ForEach(notification => notification.Instance - .OnDownload("Renamed!", message.Series) + .OnDownload(message.Series.Title, message.Series) ); } }