diff --git a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs index cd6331128..2bdbce612 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs @@ -173,30 +173,51 @@ namespace NzbDrone.Core.ImportLists // Check to see if book in DB var existingAlbum = _bookService.FindById(report.BookGoodreadsId); - if (existingAlbum != null) - { - _logger.Debug("{0} [{1}] Rejected, Book Exists in DB", report.EditionGoodreadsId, report.Book); - return; - } - // Check to see if book excluded var excludedAlbum = listExclusions.SingleOrDefault(s => s.ForeignId == report.BookGoodreadsId); + // Check to see if author excluded + var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId); + if (excludedAlbum != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.EditionGoodreadsId, report.Book); return; } - // Check to see if author excluded - var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId); - if (excludedArtist != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent author", report.EditionGoodreadsId, report.Book); return; } + if (existingAlbum != null) + { + _logger.Debug("{0} [{1}] Rejected, Book Exists in DB. Ensuring Book and Author monitored.", report.EditionGoodreadsId, report.Book); + + if (importList.ShouldMonitor != ImportListMonitorType.None) + { + if (!existingAlbum.Monitored) + { + _bookService.SetBookMonitored(existingAlbum.Id, true); + } + + var existingAuthor = existingAlbum.Author.Value; + if (importList.ShouldMonitor == ImportListMonitorType.EntireAuthor) + { + _bookService.SetMonitored(existingAuthor.Books.Value.Select(x => x.Id), true); + } + + if (!existingAuthor.Monitored) + { + existingAuthor.Monitored = true; + _authorService.UpdateAuthor(existingAuthor); + } + } + + return; + } + // Append Album if not already in DB or already on add list if (albumsToAdd.All(s => s.ForeignBookId != report.BookGoodreadsId)) { @@ -261,12 +282,6 @@ namespace NzbDrone.Core.ImportLists // Check to see if author in DB var existingArtist = _authorService.FindById(report.AuthorGoodreadsId); - if (existingArtist != null) - { - _logger.Debug("{0} [{1}] Rejected, Author Exists in DB", report.AuthorGoodreadsId, report.Author); - return; - } - // Check to see if author excluded var excludedArtist = listExclusions.Where(s => s.ForeignId == report.AuthorGoodreadsId).SingleOrDefault(); @@ -276,6 +291,19 @@ namespace NzbDrone.Core.ImportLists return; } + if (existingArtist != null) + { + _logger.Debug("{0} [{1}] Rejected, Author Exists in DB. Ensuring Author monitored", report.AuthorGoodreadsId, report.Author); + + if (!existingArtist.Monitored) + { + existingArtist.Monitored = true; + _authorService.UpdateAuthor(existingArtist); + } + + return; + } + // Append Author if not already in DB or already on add list if (artistsToAdd.All(s => s.Metadata.Value.ForeignAuthorId != report.AuthorGoodreadsId)) {