diff --git a/src/NzbDrone.Core/Profiles/Metadata/MetadataProfileService.cs b/src/NzbDrone.Core/Profiles/Metadata/MetadataProfileService.cs index 840db3b67..53afee3d1 100644 --- a/src/NzbDrone.Core/Profiles/Metadata/MetadataProfileService.cs +++ b/src/NzbDrone.Core/Profiles/Metadata/MetadataProfileService.cs @@ -35,6 +35,7 @@ public class MetadataProfileService : IMetadataProfileService, IHandle FilterBooks(Author input, int profileId) .ToDictionary(x => x.Key, y => y.ToList()); var dbAuthor = _authorService.FindById(input.ForeignAuthorId); - var localBooks = dbAuthor?.Books.Value ?? new List(); + + var localBooks = new List(); + if (dbAuthor != null) + { + localBooks = _bookService.GetBooksByAuthorMetadataId(dbAuthor.AuthorMetadataId); + var editions = _editionService.GetEditionsByAuthor(dbAuthor.Id).GroupBy(x => x.BookId).ToDictionary(x => x.Key, y => y.ToList()); + + foreach (var book in localBooks) + { + if (editions.TryGetValue(book.Id, out var bookEditions)) + { + book.Editions = bookEditions; + } + else + { + book.Editions = new List(); + } + } + } + var localFiles = _mediaFileService.GetFilesByAuthor(dbAuthor?.Id ?? 0); return FilterBooks(input.Books.Value, localBooks, localFiles, seriesLinks, profileId);