From 65aeb19486ed879246a6995353a2330f731823b9 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Thu, 28 Dec 2023 14:35:04 -0600 Subject: [PATCH] Improve Custom Format compare logging Co-authored-by: Stevie Robinson --- .../Specifications/UpgradableSpecification.cs | 6 +++++- .../Specifications/UpgradeSpecification.cs | 20 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/UpgradableSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/UpgradableSpecification.cs index 1e663e5a5..322e5c568 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/UpgradableSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/UpgradableSpecification.cs @@ -78,7 +78,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications return false; } - _logger.Debug("New item has a better custom format score"); + _logger.Debug("New item's custom formats [{0}] ({1}) improve on [{2}] ({3}), accepting", + newCustomFormats.ConcatToString(), + newFormatScore, + currentCustomFormats.ConcatToString(), + currentFormatScore); return true; } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs index b6fb450e6..01530e782 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs @@ -60,16 +60,26 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications } var currentFormats = _formatService.ParseCustomFormat(episodeFile); - var currentScore = qualityProfile.CalculateCustomFormatScore(currentFormats); + var currentFormatScore = qualityProfile.CalculateCustomFormatScore(currentFormats); + var newFormats = localEpisode.CustomFormats; + var newFormatScore = localEpisode.CustomFormatScore; - if (qualityCompare == 0 && localEpisode.CustomFormatScore < currentScore) + if (qualityCompare == 0 && newFormatScore < currentFormatScore) { - _logger.Debug("New file's custom formats [{0}] do not improve on [{1}], skipping", - localEpisode.CustomFormats.ConcatToString(), - currentFormats.ConcatToString()); + _logger.Debug("New item's custom formats [{0}] ({1}) do not improve on [{2}] ({3}), skipping", + newFormats != null ? newFormats.ConcatToString() : "", + newFormatScore, + currentFormats != null ? currentFormats.ConcatToString() : "", + currentFormatScore); return Decision.Reject("Not a Custom Format upgrade for existing episode file(s)"); } + + _logger.Debug("New item's custom formats [{0}] ({1}) improve on [{2}] ({3}), accepting", + newFormats != null ? newFormats.ConcatToString() : "", + newFormatScore, + currentFormats != null ? currentFormats.ConcatToString() : "", + currentFormatScore); } return Decision.Accept();