|
|
@ -14,7 +14,7 @@ namespace NzbDrone.Core.Notifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class NotificationService
|
|
|
|
public class NotificationService
|
|
|
|
: IHandle<AlbumGrabbedEvent>,
|
|
|
|
: IHandle<AlbumGrabbedEvent>,
|
|
|
|
IHandle<TrackDownloadedEvent>,
|
|
|
|
IHandle<TrackImportedEvent>,
|
|
|
|
IHandle<ArtistRenamedEvent>
|
|
|
|
IHandle<ArtistRenamedEvent>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly INotificationFactory _notificationFactory;
|
|
|
|
private readonly INotificationFactory _notificationFactory;
|
|
|
@ -88,7 +88,9 @@ namespace NzbDrone.Core.Notifications
|
|
|
|
Message = GetMessage(message.Album.Artist, message.Album.Albums, message.Album.ParsedAlbumInfo.Quality),
|
|
|
|
Message = GetMessage(message.Album.Artist, message.Album.Albums, message.Album.ParsedAlbumInfo.Quality),
|
|
|
|
Artist = message.Album.Artist,
|
|
|
|
Artist = message.Album.Artist,
|
|
|
|
Quality = message.Album.ParsedAlbumInfo.Quality,
|
|
|
|
Quality = message.Album.ParsedAlbumInfo.Quality,
|
|
|
|
Album = message.Album
|
|
|
|
Album = message.Album,
|
|
|
|
|
|
|
|
DownloadClient = message.DownloadClient,
|
|
|
|
|
|
|
|
DownloadId = message.DownloadId
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var notification in _notificationFactory.OnGrabEnabled())
|
|
|
|
foreach (var notification in _notificationFactory.OnGrabEnabled())
|
|
|
@ -106,20 +108,30 @@ namespace NzbDrone.Core.Notifications
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Handle(TrackDownloadedEvent message)
|
|
|
|
public void Handle(TrackImportedEvent message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var downloadMessage = new DownloadMessage();
|
|
|
|
if (!message.NewDownload)
|
|
|
|
downloadMessage.Message = GetTrackMessage(message.Track.Artist, message.Track.Tracks, message.Track.Quality);
|
|
|
|
{
|
|
|
|
downloadMessage.Artist = message.Track.Artist;
|
|
|
|
return;
|
|
|
|
downloadMessage.TrackFile = message.TrackFile;
|
|
|
|
}
|
|
|
|
downloadMessage.OldFiles = message.OldFiles;
|
|
|
|
|
|
|
|
downloadMessage.SourcePath = message.Track.Path;
|
|
|
|
var downloadMessage = new DownloadMessage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Message = GetTrackMessage(message.TrackInfo.Artist, message.TrackInfo.Tracks, message.TrackInfo.Quality),
|
|
|
|
|
|
|
|
Artist = message.TrackInfo.Artist,
|
|
|
|
|
|
|
|
TrackFile = message.ImportedTrack,
|
|
|
|
|
|
|
|
OldFiles = message.OldFiles,
|
|
|
|
|
|
|
|
SourcePath = message.TrackInfo.Path,
|
|
|
|
|
|
|
|
DownloadClient = message.DownloadClient,
|
|
|
|
|
|
|
|
DownloadId = message.DownloadId
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var notification in _notificationFactory.OnDownloadEnabled())
|
|
|
|
foreach (var notification in _notificationFactory.OnDownloadEnabled())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (ShouldHandleArtist(notification.Definition, message.Track.Artist))
|
|
|
|
if (ShouldHandleArtist(notification.Definition, message.TrackInfo.Artist))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (downloadMessage.OldFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade)
|
|
|
|
if (downloadMessage.OldFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade)
|
|
|
|
{
|
|
|
|
{
|
|
|
|