public void Handle(BookImportIncompleteEvent message) { // TODO: Build out this message so that we can pass on what failed and what was successful var downloadMessage = new BookDownloadMessage { Message = GetAlbumIncompleteImportMessage(message.TrackedDownload.DownloadItem.Title), }; foreach (var notification in _notificationFactory.OnImportFailureEnabled()) { if (ShouldHandleArtist(notification.Definition, message.TrackedDownload.RemoteBook.Author)) { notification.OnImportFailure(downloadMessage); } } }
public void Handle(BookImportedEvent message) { if (!message.NewDownload) { return; } var downloadMessage = new BookDownloadMessage { Message = GetAlbumDownloadMessage(message.Author, message.Book, message.ImportedBooks), Author = message.Author, Book = message.Book, DownloadClient = message.DownloadClient, DownloadId = message.DownloadId, BookFiles = message.ImportedBooks, OldFiles = message.OldFiles, }; foreach (var notification in _notificationFactory.OnReleaseImportEnabled()) { try { if (ShouldHandleArtist(notification.Definition, message.Author)) { if (downloadMessage.OldFiles.Empty() || ((NotificationDefinition)notification.Definition).OnUpgrade) { notification.OnReleaseImport(downloadMessage); } } } catch (Exception ex) { _logger.Warn(ex, "Unable to send OnReleaseImport notification to: " + notification.Definition.Name); } } }
public virtual void OnImportFailure(BookDownloadMessage message) { }
public virtual void OnReleaseImport(BookDownloadMessage message) { }