|
|
|
@ -384,7 +384,17 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= Math.Max(1, trackedDownload.RemoteAlbum.Albums.Count))
|
|
|
|
|
var remoteTrackCount = Math.Max(1,
|
|
|
|
|
trackedDownload.RemoteAlbum?.Albums.Sum(x =>
|
|
|
|
|
x.AlbumReleases.Value.Where(y => y.Monitored).Sum(z => z.TrackCount)) ?? 1);
|
|
|
|
|
|
|
|
|
|
var importResults = groupedTrackedDownload.Select(x => x.ImportResult).ToList();
|
|
|
|
|
var importedTrackCount = importResults.Where(c => c.Result == ImportResultType.Imported)
|
|
|
|
|
.SelectMany(c => c.ImportDecision.Item.Tracks)
|
|
|
|
|
.Count();
|
|
|
|
|
var allTracksImported = importResults.All(c => c.Result == ImportResultType.Imported) || importedTrackCount >= remoteTrackCount;
|
|
|
|
|
|
|
|
|
|
if (allTracksImported)
|
|
|
|
|
{
|
|
|
|
|
trackedDownload.State = TrackedDownloadState.Imported;
|
|
|
|
|
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importArtist.Id));
|
|
|
|
|