mirror of
https://github.com/Readarr/Readarr
synced 2026-05-05 19:20:27 +02: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())
|
if (!candidateReleases.Any())
|
||||||
{
|
{
|
||||||
|
_logger.Debug("No local candidates found, trying remote");
|
||||||
candidateReleases = _candidateService.GetRemoteCandidates(localBookRelease, idOverrides);
|
candidateReleases = _candidateService.GetRemoteCandidates(localBookRelease, idOverrides);
|
||||||
if (!config.AddNewAuthors)
|
if (!config.AddNewAuthors)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -429,13 +429,25 @@ private void AddDbIds(string authorId, Book book, Dictionary<string, AuthorMetad
|
||||||
book.UseDbFieldsFrom(dbBook);
|
book.UseDbFieldsFrom(dbBook);
|
||||||
|
|
||||||
var editions = _editionService.GetEditionsByBook(dbBook.Id).ToDictionary(x => x.ForeignEditionId);
|
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)
|
foreach (var edition in book.Editions.Value)
|
||||||
{
|
{
|
||||||
|
edition.Monitored = false;
|
||||||
if (editions.TryGetValue(edition.ForeignEditionId, out var dbEdition))
|
if (editions.TryGetValue(edition.ForeignEditionId, out var dbEdition))
|
||||||
{
|
{
|
||||||
edition.UseDbFieldsFrom(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);
|
var author = _authorService.FindById(authorId);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue