New: Improve messaging for rejected quality upgrades

(cherry picked from commit 9263fc156498ff45716f18c53ace77e87a77df38)

Closes #2885
pull/4068/head
bakerboy448 2 years ago committed by Bogdan
parent e1ebaaee15
commit 47f9d27b21

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.ImportLists;
using NzbDrone.Core.Localization;
@ -34,8 +32,6 @@ namespace NzbDrone.Core.HealthCheck.Checks
var importLists = _importListFactory.All();
var missingRootFolders = new Dictionary<string, List<ImportListDefinition>>();
Console.WriteLine(importLists.ToArray().ToJson());
foreach (var importList in importLists)
{
var rootFolderPath = importList.RootFolderPath;

@ -24,18 +24,18 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Specifications
_logger = logger;
}
public Decision IsSatisfiedBy(LocalTrack item, DownloadClientItem downloadClientItem)
public Decision IsSatisfiedBy(LocalTrack localTrack, DownloadClientItem downloadClientItem)
{
if (!item.Tracks.Any(e => e.TrackFileId > 0))
if (!localTrack.Tracks.Any(e => e.TrackFileId > 0))
{
// No existing tracks, skip. This guards against new artists not having a QualityProfile.
return Decision.Accept();
}
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
var qualityComparer = new QualityModelComparer(item.Artist.QualityProfile);
var qualityComparer = new QualityModelComparer(localTrack.Artist.QualityProfile);
foreach (var track in item.Tracks.Where(e => e.TrackFileId > 0))
foreach (var track in localTrack.Tracks.Where(e => e.TrackFileId > 0))
{
var trackFile = track.TrackFile.Value;
@ -45,18 +45,18 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Specifications
continue;
}
var qualityCompare = qualityComparer.Compare(item.Quality.Quality, trackFile.Quality.Quality);
var qualityCompare = qualityComparer.Compare(localTrack.Quality.Quality, trackFile.Quality.Quality);
if (qualityCompare < 0)
{
_logger.Debug("This file isn't a quality upgrade for all tracks. Skipping {0}", item.Path);
return Decision.Reject("Not an upgrade for existing track file(s)");
_logger.Debug("This file isn't a quality upgrade for all tracks. New Quality is {0}. Skipping {1}", localTrack.Quality.Quality, localTrack.Path);
return Decision.Reject("Not an upgrade for existing track file(s). New Quality is {0}", localTrack.Quality.Quality);
}
if (qualityCompare == 0 && downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
item.Quality.Revision.CompareTo(trackFile.Quality.Revision) < 0)
localTrack.Quality.Revision.CompareTo(trackFile.Quality.Revision) < 0)
{
_logger.Debug("This file isn't a quality upgrade for all tracks. Skipping {0}", item.Path);
_logger.Debug("This file isn't a quality upgrade for all tracks. Skipping {0}", localTrack.Path);
return Decision.Reject("Not an upgrade for existing track file(s)");
}
}

Loading…
Cancel
Save