mirror of
https://github.com/Readarr/Readarr
synced 2026-04-16 09:50:59 +02:00
Fixed: Prevent duplicate searches on list add
This commit is contained in:
parent
0e43f67a9f
commit
735fceb074
1 changed files with 22 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
|||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Books.Commands;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
|
|
@ -201,19 +202,36 @@ private void ProcessBookReport(ImportListDefinition importList, ImportListItemIn
|
|||
if (!existingBook.Monitored)
|
||||
{
|
||||
_bookService.SetBookMonitored(existingBook.Id, true);
|
||||
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.SpecificBook)
|
||||
{
|
||||
_commandQueueManager.Push(new BookSearchCommand(new List<int> { existingBook.Id }));
|
||||
}
|
||||
}
|
||||
|
||||
var existingAuthor = existingBook.Author.Value;
|
||||
var doSearch = false;
|
||||
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.EntireAuthor)
|
||||
{
|
||||
_bookService.SetMonitored(existingAuthor.Books.Value.Select(x => x.Id), true);
|
||||
if (existingAuthor.Books.Value.Any(x => !x.Monitored))
|
||||
{
|
||||
doSearch = true;
|
||||
_bookService.SetMonitored(existingAuthor.Books.Value.Select(x => x.Id), true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!existingAuthor.Monitored)
|
||||
{
|
||||
doSearch = true;
|
||||
existingAuthor.Monitored = true;
|
||||
_authorService.UpdateAuthor(existingAuthor);
|
||||
}
|
||||
|
||||
if (doSearch)
|
||||
{
|
||||
_commandQueueManager.Push(new MissingBookSearchCommand(existingAuthor.Id));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -261,7 +279,9 @@ private void ProcessBookReport(ImportListDefinition importList, ImportListItemIn
|
|||
Author = toAddAuthor,
|
||||
AddOptions = new AddBookOptions
|
||||
{
|
||||
SearchForNewBook = importList.ShouldSearch
|
||||
// Only search for new book for existing authors
|
||||
// New author searches are triggered by SearchForMissingBooks
|
||||
SearchForNewBook = importList.ShouldSearch && toAddAuthor.Id > 0
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue