Improve Custom Format compare logging

Co-authored-by: Stevie Robinson <stevie.robinson@gmail.com>
This commit is contained in:
bakerboy448 2023-12-28 14:35:04 -06:00 committed by GitHub
parent f9d9754220
commit 65aeb19486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -78,7 +78,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false; 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; return true;
} }

View File

@ -60,16 +60,26 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
} }
var currentFormats = _formatService.ParseCustomFormat(episodeFile); 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", _logger.Debug("New item's custom formats [{0}] ({1}) do not improve on [{2}] ({3}), skipping",
localEpisode.CustomFormats.ConcatToString(), newFormats != null ? newFormats.ConcatToString() : "",
currentFormats.ConcatToString()); newFormatScore,
currentFormats != null ? currentFormats.ConcatToString() : "",
currentFormatScore);
return Decision.Reject("Not a Custom Format upgrade for existing episode file(s)"); 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(); return Decision.Accept();