mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-25 15:22:42 +00:00
New: Make sure existing items on import list are monitored
This commit is contained in:
parent
2ca6a8da84
commit
d85d2bb371
1 changed files with 43 additions and 15 deletions
|
@ -161,30 +161,51 @@ private void ProcessAlbumReport(ImportListDefinition importList, ImportListItemI
|
|||
// 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);
|
||||
|
||||
// Check to see if artist excluded
|
||||
var excludedArtist = listExclusions.SingleOrDefault(s => s.ForeignId == report.ArtistMusicBrainzId);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (existingAlbum != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Album Exists in DB. Ensuring Album and Artist monitored.", report.AlbumMusicBrainzId, report.Album);
|
||||
|
||||
if (importList.ShouldMonitor != ImportListMonitorType.None)
|
||||
{
|
||||
if (!existingAlbum.Monitored)
|
||||
{
|
||||
_albumService.SetAlbumMonitored(existingAlbum.Id, true);
|
||||
}
|
||||
|
||||
var existingArtist = existingAlbum.Artist.Value;
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.EntireArtist)
|
||||
{
|
||||
_albumService.SetMonitored(existingArtist.Albums.Value.Select(x => x.Id), true);
|
||||
}
|
||||
|
||||
if (!existingArtist.Monitored)
|
||||
{
|
||||
existingArtist.Monitored = true;
|
||||
_artistService.UpdateArtist(existingArtist);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Append Album if not already in DB or already on add list
|
||||
if (albumsToAdd.All(s => s.ForeignAlbumId != report.AlbumMusicBrainzId))
|
||||
{
|
||||
|
@ -242,12 +263,6 @@ private void ProcessArtistReport(ImportListDefinition importList, ImportListItem
|
|||
// 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();
|
||||
|
||||
|
@ -257,6 +272,19 @@ private void ProcessArtistReport(ImportListDefinition importList, ImportListItem
|
|||
return;
|
||||
}
|
||||
|
||||
if (existingArtist != null)
|
||||
{
|
||||
_logger.Debug("{0} [{1}] Rejected, Author Exists in DB. Ensuring Author monitored", report.ArtistMusicBrainzId, report.Artist);
|
||||
|
||||
if (!existingArtist.Monitored)
|
||||
{
|
||||
existingArtist.Monitored = true;
|
||||
_artistService.UpdateArtist(existingArtist);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Append Artist if not already in DB or already on add list
|
||||
if (artistsToAdd.All(s => s.Metadata.Value.ForeignArtistId != report.ArtistMusicBrainzId))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue