public void SetUp() { var importListItem1 = new ImportListItemInfo { Title = "Breaking Bad" }; _importListReports = new List <ImportListItemInfo> { importListItem1 }; Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <ISearchForNewSeries>() .Setup(v => v.SearchForNewSeries(It.IsAny <string>())) .Returns(new List <Series>()); Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = MonitorTypes.All }); Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <IImportListExclusionService>() .Setup(v => v.All()) .Returns(new List <ImportListExclusion>()); }
private void MapAlbumReport(ImportListItemInfo report) { Book mappedAlbum; if (report.EditionGoodreadsId.IsNotNullOrWhiteSpace() && int.TryParse(report.EditionGoodreadsId, out var goodreadsId)) { var search = _bookSearchService.SearchByGoodreadsId(goodreadsId); mappedAlbum = search.FirstOrDefault(x => x.Editions.Value.Any(e => int.TryParse(e.ForeignEditionId, out var editionId) && editionId == goodreadsId)); } else { mappedAlbum = _bookSearchService.SearchForNewBook(report.Book, report.Author).FirstOrDefault(); } // Break if we are looking for an book and cant find it. This will avoid us from adding the author and possibly getting it wrong. if (mappedAlbum == null) { _logger.Trace($"Nothing found for {report.EditionGoodreadsId}"); report.EditionGoodreadsId = null; return; } _logger.Trace($"Mapped {report.EditionGoodreadsId} to {mappedAlbum}"); report.EditionGoodreadsId = mappedAlbum.Editions.Value.Single(x => x.Monitored).ForeignEditionId; report.BookGoodreadsId = mappedAlbum.ForeignBookId; report.Book = mappedAlbum.Title; report.Author = mappedAlbum.AuthorMetadata?.Value?.Name; report.AuthorGoodreadsId = mappedAlbum.AuthorMetadata?.Value?.ForeignAuthorId; }
public void SetUp() { var importListItem1 = new ImportListItemInfo { Author = "Linkin Park" }; _importListReports = new List <ImportListItemInfo> { importListItem1 }; Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <ISearchForNewAuthor>() .Setup(v => v.SearchForNewAuthor(It.IsAny <string>())) .Returns(new List <Author>()); Mocker.GetMock <ISearchForNewBook>() .Setup(v => v.SearchForNewBook(It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <Book>()); Mocker.GetMock <ISearchForNewBook>() .Setup(v => v.SearchByGoodreadsId(It.IsAny <int>())) .Returns <int>(x => Builder <Book> .CreateListOfSize(1) .TheFirst(1) .With(b => b.ForeignBookId = "4321") .With(b => b.Editions = Builder <Edition> .CreateListOfSize(1) .TheFirst(1) .With(e => e.ForeignEditionId = x.ToString()) .With(e => e.Monitored = true) .BuildList()) .BuildList()); Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificBook }); Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <IImportListExclusionService>() .Setup(v => v.All()) .Returns(new List <ImportListExclusion>()); Mocker.GetMock <IAddBookService>() .Setup(v => v.AddBooks(It.IsAny <List <Book> >(), false)) .Returns <List <Book>, bool>((x, y) => x); Mocker.GetMock <IAddAuthorService>() .Setup(v => v.AddAuthors(It.IsAny <List <Author> >(), false)) .Returns <List <Author>, bool>((x, y) => x); }
private void MapArtistReport(ImportListItemInfo report) { var mappedArtist = _artistSearchService.SearchForNewArtist(report.Artist) .FirstOrDefault(); report.ArtistMusicBrainzId = mappedArtist?.Metadata.Value?.ForeignArtistId; report.Artist = mappedArtist?.Metadata.Value?.Name; }
private void MapArtistReport(ImportListItemInfo report) { var mappedArtist = _authorSearchService.SearchForNewAuthor(report.Author) .FirstOrDefault(); report.AuthorGoodreadsId = mappedArtist?.Metadata.Value?.ForeignAuthorId; report.Author = mappedArtist?.Metadata.Value?.Name; }
private void ProcessAuthorReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Author> authorsToAdd) { if (report.AuthorGoodreadsId == null) { return; } // Check to see if author in DB var existingAuthor = _authorService.FindById(report.AuthorGoodreadsId); // Check to see if author excluded var excludedAuthor = listExclusions.Where(s => s.ForeignId == report.AuthorGoodreadsId).SingleOrDefault(); if (excludedAuthor != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.AuthorGoodreadsId, report.Author); return; } if (existingAuthor != null) { _logger.Debug("{0} [{1}] Rejected, Author Exists in DB. Ensuring Author monitored", report.AuthorGoodreadsId, report.Author); if (!existingAuthor.Monitored) { existingAuthor.Monitored = true; _authorService.UpdateAuthor(existingAuthor); } return; } // Append Author if not already in DB or already on add list if (authorsToAdd.All(s => s.Metadata.Value.ForeignAuthorId != report.AuthorGoodreadsId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; authorsToAdd.Add(new Author { Metadata = new AuthorMetadata { ForeignAuthorId = report.AuthorGoodreadsId, Name = report.Author }, Monitored = monitored, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddAuthorOptions { SearchForMissingBooks = importList.ShouldSearch, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }); } }
protected virtual bool IsValidRelease(ImportListItemInfo release) { if (release.Book.IsNullOrWhiteSpace() && release.Author.IsNullOrWhiteSpace()) { return(false); } return(true); }
protected virtual bool IsValidItem(ImportListItemInfo release) { if (release.Title.IsNullOrWhiteSpace()) { return false; } return true; }
public void UpdateListSyncStatus(int importListId, ImportListItemInfo listItemInfo) { lock (_syncRoot) { var status = GetProviderStatus(importListId); status.LastSyncListInfo = listItemInfo; _providerStatusRepository.Upsert(status); } }
private void MapBookReport(ImportListItemInfo report) { if (report.EditionGoodreadsId.IsNotNullOrWhiteSpace() && int.TryParse(report.EditionGoodreadsId, out var goodreadsId)) { // check the local DB var edition = _editionService.GetEditionByForeignEditionId(report.EditionGoodreadsId); if (edition != null) { var book = edition.Book.Value; report.BookGoodreadsId = book.ForeignBookId; report.Book = edition.Title; report.Author ??= book.AuthorMetadata.Value.Name; report.AuthorGoodreadsId ??= book.AuthorMetadata.Value.ForeignAuthorId; return; } try { var remoteBook = _goodreadsProxy.GetBookInfo(report.EditionGoodreadsId); _logger.Trace($"Mapped {report.EditionGoodreadsId} to [{remoteBook.ForeignBookId}] {remoteBook.Title}"); report.BookGoodreadsId = remoteBook.ForeignBookId; report.Book = remoteBook.Title; report.Author ??= remoteBook.AuthorMetadata.Value.Name; report.AuthorGoodreadsId ??= remoteBook.AuthorMetadata.Value.Name; } catch (BookNotFoundException) { _logger.Debug($"Nothing found for edition [{report.EditionGoodreadsId}]"); report.EditionGoodreadsId = null; } } else { var mappedBook = _goodreadsSearchProxy.Search($"{report.Book} {report.Author}").FirstOrDefault(); if (mappedBook == null) { _logger.Trace($"Nothing found for {report.Author} - {report.Book}"); return; } _logger.Trace($"Mapped {report.EditionGoodreadsId} to [{mappedBook.WorkId}] {mappedBook.BookTitleBare}"); report.BookGoodreadsId = mappedBook.WorkId.ToString(); report.Book = mappedBook.BookTitleBare; report.Author ??= mappedBook.Author.Name; report.AuthorGoodreadsId ??= mappedBook.Author.Id.ToString(); } }
private void WithSecondBook() { var importListItem2 = new ImportListItemInfo { Author = "Linkin Park", AuthorGoodreadsId = "f59c5520-5f46-4d2c-b2c4-822eabf53419", Book = "Meteora 2", EditionGoodreadsId = "5678", BookGoodreadsId = "8765" }; _importListReports.Add(importListItem2); }
private void ProcessArtistReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Artist> artistsToAdd) { if (report.ArtistMusicBrainzId == null) { return; } // Check to see if artist in DB var existingArtist = _artistService.FindById(report.ArtistMusicBrainzId); if (existingArtist != null) { _logger.Debug("{0} [{1}] Rejected, Artist Exists in DB", report.ArtistMusicBrainzId, report.Artist); return; } // Check to see if artist excluded var excludedArtist = listExclusions.Where(s => s.ForeignId == report.ArtistMusicBrainzId).SingleOrDefault(); if (excludedArtist != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.ArtistMusicBrainzId, report.Artist); return; } // Append Artist if not already in DB or already on add list if (artistsToAdd.All(s => s.Metadata.Value.ForeignArtistId != report.ArtistMusicBrainzId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; artistsToAdd.Add(new Artist { Metadata = new ArtistMetadata { ForeignArtistId = report.ArtistMusicBrainzId, Name = report.Artist }, Monitored = monitored, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddArtistOptions { SearchForMissingAlbums = monitored, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }); } }
private void MapAuthorReport(ImportListItemInfo report) { var mappedBook = _goodreadsSearchProxy.Search(report.Author).FirstOrDefault(); if (mappedBook == null) { _logger.Trace($"Nothing found for {report.Author}"); return; } _logger.Trace($"Mapped {report.Author} to [{mappedBook.Author.Name}]"); report.Author = mappedBook.Author.Name; report.AuthorGoodreadsId = mappedBook.Author.Id.ToString(); }
private void MapAlbumReport(ImportListItemInfo report) { var albumQuery = report.AlbumMusicBrainzId.IsNotNullOrWhiteSpace() ? $"lidarr:{report.AlbumMusicBrainzId}" : report.Album; var mappedAlbum = _albumSearchService.SearchForNewAlbum(albumQuery, report.Artist) .FirstOrDefault(); // Break if we are looking for an album and cant find it. This will avoid us from adding the artist and possibly getting it wrong. if (mappedAlbum == null) { return; } report.AlbumMusicBrainzId = mappedAlbum.ForeignAlbumId; report.Album = mappedAlbum.Title; report.Artist = mappedAlbum.ArtistMetadata?.Value?.Name; report.ArtistMusicBrainzId = mappedAlbum.ArtistMetadata?.Value?.ForeignArtistId; }
public void SetUp() { var importListItem1 = new ImportListItemInfo { Artist = "Linkin Park" }; _importListReports = new List <ImportListItemInfo> { importListItem1 }; Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <ISearchForNewArtist>() .Setup(v => v.SearchForNewArtist(It.IsAny <string>())) .Returns(new List <Artist>()); Mocker.GetMock <ISearchForNewAlbum>() .Setup(v => v.SearchForNewAlbum(It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <Album>()); Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificAlbum }); Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <IImportListExclusionService>() .Setup(v => v.All()) .Returns(new List <ImportListExclusion>()); Mocker.GetMock <IAddArtistService>() .Setup(v => v.AddArtists(It.IsAny <List <Artist> >(), false, true)) .Returns((List <Artist> artists, bool doRefresh, bool ignoreErrors) => artists); Mocker.GetMock <IAddAlbumService>() .Setup(v => v.AddAlbums(It.IsAny <List <Album> >(), false, true)) .Returns((List <Album> albums, bool doRefresh, bool ignoreErrors) => albums); }
public void SetUp() { var importListItem1 = new ImportListItemInfo { Artist = "Linkin Park" }; _importListReports = new List <ImportListItemInfo> { importListItem1 }; Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <ISearchForNewArtist>() .Setup(v => v.SearchForNewArtist(It.IsAny <string>())) .Returns(new List <Artist>()); Mocker.GetMock <ISearchForNewAlbum>() .Setup(v => v.SearchForNewAlbum(It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <Album>()); Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = ImportListMonitorType.SpecificAlbum }); Mocker.GetMock <IFetchAndParseImportList>() .Setup(v => v.Fetch()) .Returns(_importListReports); Mocker.GetMock <IImportListExclusionService>() .Setup(v => v.All()) .Returns(new List <ImportListExclusion>()); }
private void ProcessBookReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Book> booksToAdd) { if (report.EditionGoodreadsId == null) { return; } // Check to see if book in DB var existingBook = _bookService.FindById(report.BookGoodreadsId); // Check to see if book excluded var excludedBook = listExclusions.SingleOrDefault(s => s.ForeignId == report.BookGoodreadsId); // Check to see if author excluded var excludedAuthor = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId); if (excludedBook != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.EditionGoodreadsId, report.Book); return; } if (excludedAuthor != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent author", report.EditionGoodreadsId, report.Book); return; } if (existingBook != 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 (!existingBook.Monitored) { _bookService.SetBookMonitored(existingBook.Id, true); } var existingAuthor = existingBook.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 Book if not already in DB or already on add list if (booksToAdd.All(s => s.ForeignBookId != report.BookGoodreadsId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; var toAdd = new Book { ForeignBookId = report.BookGoodreadsId, Monitored = monitored, Editions = new List <Edition> { new Edition { ForeignEditionId = report.EditionGoodreadsId, Monitored = true } }, Author = new Author { Monitored = monitored, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddAuthorOptions { SearchForMissingBooks = importList.ShouldSearch, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }, AddOptions = new AddBookOptions { SearchForNewBook = monitored } }; if (importList.ShouldMonitor == ImportListMonitorType.SpecificBook) { toAdd.Author.Value.AddOptions.BooksToMonitor.Add(toAdd.ForeignBookId); } booksToAdd.Add(toAdd); } }
private void ProcessAlbumReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Book> albumsToAdd) { if (report.EditionGoodreadsId == null) { return; } // Check to see if book in DB var existingAlbum = _bookService.FindById(report.EditionGoodreadsId); 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.EditionGoodreadsId); 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; } // Append Album if not already in DB or already on add list if (albumsToAdd.All(s => s.ForeignBookId != report.EditionGoodreadsId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; var toAdd = new Book { ForeignBookId = report.BookGoodreadsId, Monitored = monitored, Editions = new List <Edition> { new Edition { ForeignEditionId = report.EditionGoodreadsId, Monitored = true } }, Author = new Author { Monitored = monitored, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddAuthorOptions { SearchForMissingBooks = monitored, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }, }; if (importList.ShouldMonitor == ImportListMonitorType.SpecificBook) { toAdd.Author.Value.AddOptions.BooksToMonitor.Add(toAdd.ForeignBookId); } albumsToAdd.Add(toAdd); } }
private void ProcessBookReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Book> booksToAdd, List <Author> authorsToAdd) { if (report.EditionGoodreadsId == null) { return; } // Check to see if book in DB var existingBook = _bookService.FindById(report.BookGoodreadsId); // Check to see if book excluded var excludedBook = listExclusions.SingleOrDefault(s => s.ForeignId == report.BookGoodreadsId); // Check to see if author excluded var excludedAuthor = listExclusions.SingleOrDefault(s => s.ForeignId == report.AuthorGoodreadsId); if (excludedBook != null) { _logger.Debug("{0} [{1}] Rejected due to list exclusion", report.EditionGoodreadsId, report.Book); return; } if (excludedAuthor != null) { _logger.Debug("{0} [{1}] Rejected due to list exclusion for parent author", report.EditionGoodreadsId, report.Book); return; } if (existingBook != null) { _logger.Debug("{0} [{1}] Rejected, Book Exists in DB. Ensuring Book and Author monitored.", report.EditionGoodreadsId, report.Book); if (importList.ShouldMonitorExisting && importList.ShouldMonitor != ImportListMonitorType.None) { 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) { 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; } // Append Book if not already in DB or already on add list if (booksToAdd.All(s => s.ForeignBookId != report.BookGoodreadsId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; var toAddAuthor = new Author { Monitored = monitored, MonitorNewItems = importList.MonitorNewItems, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddAuthorOptions { SearchForMissingBooks = importList.ShouldSearch, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }; if (report.AuthorGoodreadsId != null && report.Author != null) { toAddAuthor = ProcessAuthorReport(importList, report, listExclusions, authorsToAdd); } var toAdd = new Book { ForeignBookId = report.BookGoodreadsId, Monitored = monitored, AnyEditionOk = true, Editions = new List <Edition> { new Edition { ForeignEditionId = report.EditionGoodreadsId, Monitored = true } }, Author = toAddAuthor, AddOptions = new AddBookOptions { // Only search for new book for existing authors // New author searches are triggered by SearchForMissingBooks SearchForNewBook = importList.ShouldSearch && toAddAuthor.Id > 0 } }; if (importList.ShouldMonitor == ImportListMonitorType.SpecificBook && toAddAuthor.AddOptions != null) { Debug.Assert(toAddAuthor.Id == 0, "new author added but ID is not 0"); toAddAuthor.AddOptions.BooksToMonitor.Add(toAdd.ForeignBookId); } booksToAdd.Add(toAdd); } }
private void ProcessAlbumReport(ImportListDefinition importList, ImportListItemInfo report, List <ImportListExclusion> listExclusions, List <Album> albumsToAdd) { if (report.AlbumMusicBrainzId == null) { return; } // Check to see if album in DB var existingAlbum = _albumService.FindById(report.AlbumMusicBrainzId); if (existingAlbum != null) { _logger.Debug("{0} [{1}] Rejected, Album Exists in DB", report.AlbumMusicBrainzId, report.Album); return; } // Check to see if album excluded var excludedAlbum = listExclusions.SingleOrDefault(s => s.ForeignId == report.AlbumMusicBrainzId); if (excludedAlbum != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion", report.AlbumMusicBrainzId, report.Album); return; } // Check to see if artist excluded var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.ArtistMusicBrainzId); if (excludedArtist != null) { _logger.Debug("{0} [{1}] Rejected due to list exlcusion for parent artist", report.AlbumMusicBrainzId, report.Album); return; } // Append Album if not already in DB or already on add list if (albumsToAdd.All(s => s.ForeignAlbumId != report.AlbumMusicBrainzId)) { var monitored = importList.ShouldMonitor != ImportListMonitorType.None; var toAdd = new Album { ForeignAlbumId = report.AlbumMusicBrainzId, Monitored = monitored, AnyReleaseOk = true, Artist = new Artist { Monitored = monitored, RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.ProfileId, MetadataProfileId = importList.MetadataProfileId, Tags = importList.Tags, AddOptions = new AddArtistOptions { SearchForMissingAlbums = monitored, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } }, AddOptions = new AddAlbumOptions { SearchForNewAlbum = monitored } }; if (importList.ShouldMonitor == ImportListMonitorType.SpecificAlbum) { toAdd.Artist.Value.AddOptions.AlbumsToMonitor.Add(toAdd.ForeignAlbumId); } albumsToAdd.Add(toAdd); } }