1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Improve Release Title Custom Format debugging

(cherry picked from commit ec40bc6eea1eb282cb804b8dd5461bf5ade332e9)

Closes #9653
This commit is contained in:
bakerboy448 2024-01-19 23:30:24 -06:00 committed by Bogdan
parent 34eb59dde4
commit fcd187970c

View File

@ -2,6 +2,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;
@ -25,10 +26,12 @@ public interface ICustomFormatCalculationService
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<CustomFormat> ParseCustomFormat(RemoteMovie remoteMovie, long size)
@ -165,20 +168,23 @@ private static List<CustomFormat> ParseCustomFormat(CustomFormatInput input, Lis
return matches.OrderBy(x => x.Name).ToList();
}
private static List<CustomFormat> ParseCustomFormat(MovieFile movieFile, Movie movie, List<CustomFormat> allCustomFormats)
private List<CustomFormat> ParseCustomFormat(MovieFile movieFile, Movie movie, List<CustomFormat> allCustomFormats)
{
var releaseTitle = string.Empty;
if (movieFile.SceneName.IsNotNullOrWhiteSpace())
{
_logger.Trace("Using scene name for release title: {0}", movieFile.SceneName);
releaseTitle = movieFile.SceneName;
}
else if (movieFile.OriginalFilePath.IsNotNullOrWhiteSpace())
{
_logger.Trace("Using original file path for release title: {0}", Path.GetFileName(movieFile.OriginalFilePath));
releaseTitle = Path.GetFileName(movieFile.OriginalFilePath);
}
else if (movieFile.RelativePath.IsNotNullOrWhiteSpace())
{
_logger.Trace("Using relative path for release title: {0}", Path.GetFileName(movieFile.RelativePath));
releaseTitle = Path.GetFileName(movieFile.RelativePath);
}