mirror of https://github.com/lidarr/Lidarr
Improve Release Title Custom Format debugging
(cherry picked from commit ec40bc6eea1eb282cb804b8dd5461bf5ade332e9) Closes #4485
This commit is contained in:
parent
7d54c5cfef
commit
2cf2ebcbb2
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Blocklisting;
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
|
@ -23,10 +24,12 @@ namespace NzbDrone.Core.CustomFormats
|
||||||
public class CustomFormatCalculationService : ICustomFormatCalculationService
|
public class CustomFormatCalculationService : ICustomFormatCalculationService
|
||||||
{
|
{
|
||||||
private readonly ICustomFormatService _formatService;
|
private readonly ICustomFormatService _formatService;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public CustomFormatCalculationService(ICustomFormatService formatService)
|
public CustomFormatCalculationService(ICustomFormatService formatService, Logger logger)
|
||||||
{
|
{
|
||||||
_formatService = formatService;
|
_formatService = formatService;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CustomFormat> ParseCustomFormat(RemoteAlbum remoteAlbum, long size)
|
public List<CustomFormat> ParseCustomFormat(RemoteAlbum remoteAlbum, long size)
|
||||||
|
@ -145,26 +148,30 @@ namespace NzbDrone.Core.CustomFormats
|
||||||
return matches.OrderBy(x => x.Name).ToList();
|
return matches.OrderBy(x => x.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<CustomFormat> ParseCustomFormat(TrackFile trackFile, Artist artist, List<CustomFormat> allCustomFormats)
|
private List<CustomFormat> ParseCustomFormat(TrackFile trackFile, Artist artist, List<CustomFormat> allCustomFormats)
|
||||||
{
|
{
|
||||||
var sceneName = string.Empty;
|
var releaseTitle = string.Empty;
|
||||||
|
|
||||||
if (trackFile.SceneName.IsNotNullOrWhiteSpace())
|
if (trackFile.SceneName.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
sceneName = trackFile.SceneName;
|
_logger.Trace("Using scene name for release title: {0}", trackFile.SceneName);
|
||||||
|
releaseTitle = trackFile.SceneName;
|
||||||
}
|
}
|
||||||
else if (trackFile.OriginalFilePath.IsNotNullOrWhiteSpace())
|
else if (trackFile.OriginalFilePath.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
sceneName = trackFile.OriginalFilePath;
|
_logger.Trace("Using original file path for release title: {0}", Path.GetFileName(trackFile.OriginalFilePath));
|
||||||
|
releaseTitle = trackFile.OriginalFilePath;
|
||||||
}
|
}
|
||||||
else if (trackFile.Path.IsNotNullOrWhiteSpace())
|
else if (trackFile.Path.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
sceneName = Path.GetFileName(trackFile.Path);
|
_logger.Trace("Using path for release title: {0}", Path.GetFileName(trackFile.Path));
|
||||||
|
releaseTitle = Path.GetFileName(trackFile.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeInfo = new ParsedAlbumInfo
|
var episodeInfo = new ParsedAlbumInfo
|
||||||
{
|
{
|
||||||
ArtistName = artist.Name,
|
ArtistName = artist.Name,
|
||||||
ReleaseTitle = sceneName,
|
ReleaseTitle = releaseTitle,
|
||||||
Quality = trackFile.Quality,
|
Quality = trackFile.Quality,
|
||||||
ReleaseGroup = trackFile.ReleaseGroup
|
ReleaseGroup = trackFile.ReleaseGroup
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue