From 47f9d27b21db28d16d912cda7f7c5b2a7811a673 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Sun, 7 Aug 2022 13:54:15 -0500 Subject: [PATCH] New: Improve messaging for rejected quality upgrades (cherry picked from commit 9263fc156498ff45716f18c53ace77e87a77df38) Closes #2885 --- .../Checks/ImportListRootFolderCheck.cs | 4 ---- .../Specifications/UpgradeSpecification.cs | 18 +++++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs index e5367c28c..cbf6ecfec 100644 --- a/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs +++ b/src/NzbDrone.Core/HealthCheck/Checks/ImportListRootFolderCheck.cs @@ -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>(); - Console.WriteLine(importLists.ToArray().ToJson()); - foreach (var importList in importLists) { var rootFolderPath = importList.RootFolderPath; diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Specifications/UpgradeSpecification.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Specifications/UpgradeSpecification.cs index 7632f15d8..268f627a9 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Specifications/UpgradeSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Specifications/UpgradeSpecification.cs @@ -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)"); } }