From ec40bc6eea1eb282cb804b8dd5461bf5ade332e9 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 19 Jan 2024 23:30:24 -0600 Subject: [PATCH] Improve Release Title Custom Format debugging Towards #5598 --- .../CustomFormats/CustomFormatCalculationService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs index e344c355f..1840d087c 100644 --- a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs +++ b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Core.Blocklisting; using NzbDrone.Core.History; @@ -23,10 +24,12 @@ namespace NzbDrone.Core.CustomFormats public class CustomFormatCalculationService : ICustomFormatCalculationService { private readonly ICustomFormatService _formatService; + private readonly Logger _logger; - public CustomFormatCalculationService(ICustomFormatService formatService) + public CustomFormatCalculationService(ICustomFormatService formatService, Logger logger) { _formatService = formatService; + _logger = logger; } public List ParseCustomFormat(RemoteEpisode remoteEpisode, long size) @@ -153,20 +156,23 @@ namespace NzbDrone.Core.CustomFormats return matches.OrderBy(x => x.Name).ToList(); } - private static List ParseCustomFormat(EpisodeFile episodeFile, Series series, List allCustomFormats) + private List ParseCustomFormat(EpisodeFile episodeFile, Series series, List allCustomFormats) { var releaseTitle = string.Empty; if (episodeFile.SceneName.IsNotNullOrWhiteSpace()) { + _logger.Trace("Using scene name for release title: {0}", episodeFile.SceneName); releaseTitle = episodeFile.SceneName; } else if (episodeFile.OriginalFilePath.IsNotNullOrWhiteSpace()) { + _logger.Trace("Using original file path for release title: {0}", Path.GetFileName(episodeFile.OriginalFilePath)); releaseTitle = Path.GetFileName(episodeFile.OriginalFilePath); } else if (episodeFile.RelativePath.IsNotNullOrWhiteSpace()) { + _logger.Trace("Using relative path for release title: {0}", Path.GetFileName(episodeFile.RelativePath)); releaseTitle = Path.GetFileName(episodeFile.RelativePath); }