From a9b16d298f86d2c2ca0e44aeb2d9d51b66d6404f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 12 Feb 2023 22:33:45 -0800 Subject: [PATCH] Improve CF calculation for files without scene name Fixed: Use original filename instead of complete path when calculating CF for existing file without scene name (cherry picked from commit 997aabbc3cfc3c9c5c220786d1d08cfceec5e2f2) Closes #3359 --- .../CustomFormats/CustomFormatCalculationService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs index 253bdcfdc..6f8421c13 100644 --- a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs +++ b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs @@ -58,7 +58,7 @@ namespace NzbDrone.Core.CustomFormats { var parsed = Parser.Parser.ParseAlbumTitle(blocklist.SourceTitle); - var episodeInfo = new ParsedAlbumInfo + var albumInfo = new ParsedAlbumInfo { ArtistName = artist.Name, ReleaseTitle = parsed?.ReleaseTitle ?? blocklist.SourceTitle, @@ -68,7 +68,7 @@ namespace NzbDrone.Core.CustomFormats var input = new CustomFormatInput { - AlbumInfo = episodeInfo, + AlbumInfo = albumInfo, Artist = artist, Size = blocklist.Size ?? 0 }; @@ -160,7 +160,7 @@ namespace NzbDrone.Core.CustomFormats else if (trackFile.OriginalFilePath.IsNotNullOrWhiteSpace()) { _logger.Trace("Using original file path for release title: {0}", Path.GetFileName(trackFile.OriginalFilePath)); - releaseTitle = trackFile.OriginalFilePath; + releaseTitle = Path.GetFileName(trackFile.OriginalFilePath); } else if (trackFile.Path.IsNotNullOrWhiteSpace()) { @@ -168,7 +168,7 @@ namespace NzbDrone.Core.CustomFormats releaseTitle = Path.GetFileName(trackFile.Path); } - var episodeInfo = new ParsedAlbumInfo + var albumInfo = new ParsedAlbumInfo { ArtistName = artist.Name, ReleaseTitle = releaseTitle, @@ -178,7 +178,7 @@ namespace NzbDrone.Core.CustomFormats var input = new CustomFormatInput { - AlbumInfo = episodeInfo, + AlbumInfo = albumInfo, Artist = artist, Size = trackFile.Size, Filename = Path.GetFileName(trackFile.Path)