1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00

Notifications have real messages now

This commit is contained in:
Mark McDowall 2013-06-04 19:15:39 -07:00
parent 942679d4bd
commit 66bce4b51e

View file

@ -9,6 +9,7 @@
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Parser.Model;
using Omu.ValueInjecter; using Omu.ValueInjecter;
namespace NzbDrone.Core.Notifications namespace NzbDrone.Core.Notifications
@ -133,13 +134,21 @@ private INotification GetInstance(NotificationDefinition indexerDefinition)
return instance; 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) public void Handle(EpisodeGrabbedEvent message)
{ {
All().Where(n => n.OnGrab) All().Where(n => n.OnGrab)
.ToList() .ToList()
.ForEach(notification => .ForEach(notification =>
notification.Instance notification.Instance
.OnGrab("Grabbed!") .OnGrab(GetMessage(message.Episode.ParsedEpisodeInfo))
); );
} }
@ -149,7 +158,7 @@ public void Handle(EpisodeDownloadedEvent message)
.ToList() .ToList()
.ForEach(notification => .ForEach(notification =>
notification.Instance notification.Instance
.OnDownload("Downloaded!", message.Series) .OnDownload(GetMessage(message.ParsedEpisodeInfo), message.Series)
); );
} }
@ -159,7 +168,7 @@ public void Handle(SeriesRenamedEvent message)
.ToList() .ToList()
.ForEach(notification => .ForEach(notification =>
notification.Instance notification.Instance
.OnDownload("Renamed!", message.Series) .OnDownload(message.Series.Title, message.Series)
); );
} }
} }