diff --git a/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs b/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs index 7a640fad6..6f6eedc20 100644 --- a/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs @@ -137,10 +137,21 @@ public Author GetAuthorAndBooks(string foreignAuthorId, double minPopularity = 0 if (existingAuthor != null) { var existingEditions = _editionService.GetEditionsByAuthor(existingAuthor.Id); - var extraEditionIds = existingEditions.Select(x => x.ForeignEditionId).Except(books.Select(x => x.Editions.Value.First().ForeignEditionId)); + var extraEditionIds = existingEditions + .Select(x => x.ForeignEditionId) + .Except(books.Select(x => x.Editions.Value.First().ForeignEditionId)) + .ToList(); _logger.Debug($"Getting data for extra editions {extraEditionIds.ConcatToString()}"); - var extraEditions = extraEditionIds.Select(x => GetBookInfo(x)); + + var extraEditions = new List>>(); + foreach (var id in extraEditionIds) + { + if (TryGetBookInfo(id, true, out var result)) + { + extraEditions.Add(result); + } + } var bookDict = books.ToDictionary(x => x.ForeignBookId); foreach (var edition in extraEditions) @@ -313,6 +324,21 @@ private HashSet GetChangedBooksUncached(DateTime startTime) return null; } + private bool TryGetBookInfo(string foreignEditionId, bool useCache, out Tuple> result) + { + try + { + result = GetBookInfo(foreignEditionId, useCache); + return true; + } + catch (BookNotFoundException e) + { + result = null; + _logger.Warn(e, "Book not found"); + return false; + } + } + public Tuple> GetBookInfo(string foreignEditionId, bool useCache = true) { _logger.Debug("Getting Book with GoodreadsId of {0}", foreignEditionId);