mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
Fixed: Adding alternative edition of a book via goodreads id
This commit is contained in:
@@ -438,10 +438,20 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
||||
var book = _bookService.FindById(remote.Item2.ForeignBookId);
|
||||
var result = book ?? remote.Item2;
|
||||
|
||||
var edition = _editionService.GetEditionByForeignEditionId(remote.Item2.Editions.Value.Single(x => x.Monitored).ForeignEditionId);
|
||||
if (edition != null)
|
||||
// at this point, book could have the wrong edition.
|
||||
// Check if we already have the correct edition.
|
||||
var remoteEdition = remote.Item2.Editions.Value.Single(x => x.Monitored);
|
||||
var localEdition = _editionService.GetEditionByForeignEditionId(remoteEdition.ForeignEditionId);
|
||||
if (localEdition != null)
|
||||
{
|
||||
result.Editions = new List<Edition> { edition };
|
||||
result.Editions = new List<Edition> { localEdition };
|
||||
}
|
||||
|
||||
// If we don't have the correct edition in the response, add it in.
|
||||
if (!result.Editions.Value.Any(x => x.ForeignEditionId == remoteEdition.ForeignEditionId))
|
||||
{
|
||||
result.Editions.Value.ForEach(x => x.Monitored = false);
|
||||
result.Editions.Value.Add(remoteEdition);
|
||||
}
|
||||
|
||||
var author = _authorService.FindById(remote.Item1);
|
||||
|
||||
Reference in New Issue
Block a user