예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 public virtual void OnImportFailure(BookDownloadMessage message)
 {
 }
예제 #4
0
 public virtual void OnReleaseImport(BookDownloadMessage message)
 {
 }