Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
 public void Handle(BookImportedEvent message)
 {
     BroadcastResourceChange(ModelAction.Updated, GetAuthorResource(message.Author));
 }
Exemplo n.º 3
0
 public void Handle(BookImportedEvent message)
 {
     BroadcastResourceChange(ModelAction.Updated, MapToResource(message.Book, true));
 }
Exemplo n.º 4
0
 public void Handle(BookImportedEvent message)
 {
     _cache.Remove("AllAuthors");
     _cache.Remove(message.Author.Id.ToString());
 }