mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 12:42:51 +02: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
|
// Check to see if book in DB
|
||||||
var existingAlbum = _bookService.FindById(report.BookGoodreadsId);
|
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
|
// Check to see if book excluded
|
||||||
var excludedAlbum = listExclusions.SingleOrDefault(s => s.ForeignId == report.BookGoodreadsId);
|
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)
|
if (excludedAlbum != null)
|
||||||
{
|
{
|
||||||
_logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.EditionGoodreadsId, report.Book);
|
_logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.EditionGoodreadsId, report.Book);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if author excluded
|
|
||||||
var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId);
|
|
||||||
|
|
||||||
if (excludedArtist != null)
|
if (excludedArtist != null)
|
||||||
{
|
{
|
||||||
_logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent author", report.EditionGoodreadsId, report.Book);
|
_logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent author", report.EditionGoodreadsId, report.Book);
|
||||||
return;
|
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
|
// Append Album if not already in DB or already on add list
|
||||||
if (albumsToAdd.All(s => s.ForeignBookId != report.BookGoodreadsId))
|
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
|
// Check to see if author in DB
|
||||||
var existingArtist = _authorService.FindById(report.AuthorGoodreadsId);
|
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
|
// Check to see if author excluded
|
||||||
var excludedArtist = listExclusions.Where(s => s.ForeignId == report.AuthorGoodreadsId).SingleOrDefault();
|
var excludedArtist = listExclusions.Where(s => s.ForeignId == report.AuthorGoodreadsId).SingleOrDefault();
|
||||||
|
|
||||||
|
|
@ -276,6 +291,19 @@ private void ProcessArtistReport(ImportListDefinition importList, ImportListItem
|
||||||
return;
|
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
|
// Append Author if not already in DB or already on add list
|
||||||
if (artistsToAdd.All(s => s.Metadata.Value.ForeignAuthorId != report.AuthorGoodreadsId))
|
if (artistsToAdd.All(s => s.Metadata.Value.ForeignAuthorId != report.AuthorGoodreadsId))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue