mirror of
https://github.com/Readarr/Readarr
synced 2025-12-16 05:12:42 +01:00
New: Make sure existing items on import list are monitored
This commit is contained in:
parent
134e13190d
commit
e52035564d
1 changed files with 43 additions and 15 deletions
|
|
@ -173,30 +173,51 @@ private void ProcessAlbumReport(ImportListDefinition importList, ImportListItemI
|
|||
// Check to see if book in DB
|
||||
var existingAlbum = _bookService.FindById(report.BookGoodreadsId);
|
||||
|
||||
if (existingAlbum != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Book Exists in DB", report.EditionGoodreadsId, report.Book);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to see if book excluded
|
||||
var excludedAlbum = listExclusions.SingleOrDefault(s => s.ForeignId == report.BookGoodreadsId);
|
||||
|
||||
// Check to see if author excluded
|
||||
var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId);
|
||||
|
||||
if (excludedAlbum != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.EditionGoodreadsId, report.Book);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to see if author excluded
|
||||
var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId);
|
||||
|
||||
if (excludedArtist != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent author", report.EditionGoodreadsId, report.Book);
|
||||
return;
|
||||
}
|
||||
|
||||
if (existingAlbum != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Book Exists in DB. Ensuring Book and Author monitored.", report.EditionGoodreadsId, report.Book);
|
||||
|
||||
if (importList.ShouldMonitor != ImportListMonitorType.None)
|
||||
{
|
||||
if (!existingAlbum.Monitored)
|
||||
{
|
||||
_bookService.SetBookMonitored(existingAlbum.Id, true);
|
||||
}
|
||||
|
||||
var existingAuthor = existingAlbum.Author.Value;
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.EntireAuthor)
|
||||
{
|
||||
_bookService.SetMonitored(existingAuthor.Books.Value.Select(x => x.Id), true);
|
||||
}
|
||||
|
||||
if (!existingAuthor.Monitored)
|
||||
{
|
||||
existingAuthor.Monitored = true;
|
||||
_authorService.UpdateAuthor(existingAuthor);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Append Album if not already in DB or already on add list
|
||||
if (albumsToAdd.All(s => s.ForeignBookId != report.BookGoodreadsId))
|
||||
{
|
||||
|
|
@ -261,12 +282,6 @@ private void ProcessArtistReport(ImportListDefinition importList, ImportListItem
|
|||
// Check to see if author in DB
|
||||
var existingArtist = _authorService.FindById(report.AuthorGoodreadsId);
|
||||
|
||||
if (existingArtist != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Author Exists in DB", report.AuthorGoodreadsId, report.Author);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to see if author excluded
|
||||
var excludedArtist = listExclusions.Where(s => s.ForeignId == report.AuthorGoodreadsId).SingleOrDefault();
|
||||
|
||||
|
|
@ -276,6 +291,19 @@ private void ProcessArtistReport(ImportListDefinition importList, ImportListItem
|
|||
return;
|
||||
}
|
||||
|
||||
if (existingArtist != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Author Exists in DB. Ensuring Author monitored", report.AuthorGoodreadsId, report.Author);
|
||||
|
||||
if (!existingArtist.Monitored)
|
||||
{
|
||||
existingArtist.Monitored = true;
|
||||
_authorService.UpdateAuthor(existingArtist);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Append Author if not already in DB or already on add list
|
||||
if (artistsToAdd.All(s => s.Metadata.Value.ForeignAuthorId != report.AuthorGoodreadsId))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue