1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Notifications work for daily shows

This commit is contained in:
Mark McDowall 2013-07-26 08:22:02 -07:00
parent 224ef64e6e
commit 07073be73c

View File

@ -136,6 +136,13 @@ private INotification GetInstance(NotificationDefinition indexerDefinition)
private string GetMessage(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
{
if (series.SeriesType == SeriesTypes.Daily)
{
return String.Format("{0} - {1}",
series.Title,
parsedEpisodeInfo.AirDate.Value.ToString(Episode.AIR_DATE_FORMAT));
}
return String.Format("{0} - {1}{2}",
series.Title,
parsedEpisodeInfo.SeasonNumber,
@ -144,21 +151,25 @@ private string GetMessage(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
public void Handle(EpisodeGrabbedEvent message)
{
var messageBody = GetMessage(message.Episode.ParsedEpisodeInfo, message.Episode.Series);
All().Where(n => n.OnGrab)
.ToList()
.ForEach(notification =>
notification.Instance
.OnGrab(GetMessage(message.Episode.ParsedEpisodeInfo, message.Episode.Series))
.OnGrab(messageBody)
);
}
public void Handle(EpisodeDownloadedEvent message)
{
var messageBody = GetMessage(message.ParsedEpisodeInfo, message.Series);
All().Where(n => n.OnDownload)
.ToList()
.ForEach(notification =>
notification.Instance
.OnDownload(GetMessage(message.ParsedEpisodeInfo, message.Series), message.Series)
.OnDownload(messageBody, message.Series)
);
}