コード例 #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(BookImportIncompleteEvent message)
        {
            var history = new DownloadHistory
            {
                EventType        = DownloadHistoryEventType.DownloadImportIncomplete,
                AuthorId         = message.TrackedDownload.RemoteBook?.Author?.Id ?? 0,
                DownloadId       = message.TrackedDownload.DownloadItem.DownloadId,
                SourceTitle      = message.TrackedDownload.DownloadItem.OutputPath.ToString(),
                Date             = DateTime.UtcNow,
                Protocol         = message.TrackedDownload.Protocol,
                DownloadClientId = message.TrackedDownload.DownloadClient
            };

            history.Data.Add("DownloadClient", message.TrackedDownload.DownloadItem.DownloadClientInfo.Type);
            history.Data.Add("DownloadClientName", message.TrackedDownload.DownloadItem.DownloadClientInfo.Name);
            history.Data.Add("StatusMessages", message.TrackedDownload.StatusMessages.ToJson());

            _repository.Insert(history);
        }
コード例 #3
0
        public void Handle(BookImportIncompleteEvent message)
        {
            foreach (var book in message.TrackedDownload.RemoteBook.Books)
            {
                var history = new History
                {
                    EventType   = HistoryEventType.BookImportIncomplete,
                    Date        = DateTime.UtcNow,
                    Quality     = message.TrackedDownload.RemoteBook.ParsedBookInfo?.Quality ?? new QualityModel(),
                    SourceTitle = message.TrackedDownload.DownloadItem.Title,
                    AuthorId    = book.AuthorId,
                    BookId      = book.Id,
                    DownloadId  = message.TrackedDownload.DownloadItem.DownloadId
                };

                history.Data.Add("StatusMessages", message.TrackedDownload.StatusMessages.ToJson());
                _historyRepository.Insert(history);
            }
        }