mirror of
https://github.com/Readarr/Readarr
synced 2025-12-28 19:22:57 +01:00
Fixed: Make sure exactly one edition is monitored when using remote candidates
This commit is contained in:
parent
2a4f681b17
commit
ef35efb127
2 changed files with 13 additions and 0 deletions
|
|
@ -132,6 +132,7 @@ private void IdentifyRelease(LocalEdition localBookRelease, IdentificationOverri
|
|||
|
||||
if (!candidateReleases.Any())
|
||||
{
|
||||
_logger.Debug("No local candidates found, trying remote");
|
||||
candidateReleases = _candidateService.GetRemoteCandidates(localBookRelease, idOverrides);
|
||||
if (!config.AddNewAuthors)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -429,13 +429,25 @@ private void AddDbIds(string authorId, Book book, Dictionary<string, AuthorMetad
|
|||
book.UseDbFieldsFrom(dbBook);
|
||||
|
||||
var editions = _editionService.GetEditionsByBook(dbBook.Id).ToDictionary(x => x.ForeignEditionId);
|
||||
|
||||
// If we have any database editions, exactly one will be monitored.
|
||||
// So unmonitor all the found editions and let the UseDbFieldsFrom set
|
||||
// the monitored status
|
||||
foreach (var edition in book.Editions.Value)
|
||||
{
|
||||
edition.Monitored = false;
|
||||
if (editions.TryGetValue(edition.ForeignEditionId, out var dbEdition))
|
||||
{
|
||||
edition.UseDbFieldsFrom(dbEdition);
|
||||
}
|
||||
}
|
||||
|
||||
// Double check at least one edition is monitored
|
||||
if (book.Editions.Value.Any() && !book.Editions.Value.Any(x => x.Monitored))
|
||||
{
|
||||
var mostPopular = book.Editions.Value.OrderByDescending(x => x.Ratings.Popularity).First();
|
||||
mostPopular.Monitored = true;
|
||||
}
|
||||
}
|
||||
|
||||
var author = _authorService.FindById(authorId);
|
||||
|
|
|
|||
Loading…
Reference in a new issue