From ac1da45ecd33422095a26c75b3a357987f0941e7 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 6 Jul 2024 02:33:33 +0300 Subject: [PATCH] Fixed: Calculate Custom Formats after user specified options in Manual Import --- .../Manual/ManualImportService.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index f1fcd03cf..91599f843 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -395,14 +395,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual item.Name = Path.GetFileNameWithoutExtension(decision.LocalEpisode.Path); item.DownloadId = downloadId; - if (decision.LocalEpisode.Series != null) - { - item.Series = decision.LocalEpisode.Series; - - item.CustomFormats = _formatCalculator.ParseCustomFormat(decision.LocalEpisode); - item.CustomFormatScore = item.Series.QualityProfile?.Value.CalculateCustomFormatScore(item.CustomFormats) ?? 0; - } - if (decision.LocalEpisode.Episodes.Any() && decision.LocalEpisode.Episodes.Select(c => c.SeasonNumber).Distinct().Count() == 1) { var seasons = decision.LocalEpisode.Episodes.Select(c => c.SeasonNumber).Distinct().ToList(); @@ -430,6 +422,14 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual item.IndexerFlags = (int)decision.LocalEpisode.IndexerFlags; item.ReleaseType = decision.LocalEpisode.ReleaseType; + if (decision.LocalEpisode.Series != null) + { + item.Series = decision.LocalEpisode.Series; + + item.CustomFormats = _formatCalculator.ParseCustomFormat(decision.LocalEpisode); + item.CustomFormatScore = item.Series.QualityProfile?.Value.CalculateCustomFormatScore(item.CustomFormats) ?? 0; + } + return item; } @@ -506,8 +506,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual // Augment episode file so imported files have all additional information an automatic import would localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem); - localEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(localEpisode); - localEpisode.CustomFormatScore = localEpisode.Series.QualityProfile?.Value.CalculateCustomFormatScore(localEpisode.CustomFormats) ?? 0; // Apply the user-chosen values. localEpisode.Series = series; @@ -518,6 +516,9 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual localEpisode.IndexerFlags = (IndexerFlags)file.IndexerFlags; localEpisode.ReleaseType = file.ReleaseType; + localEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(localEpisode); + localEpisode.CustomFormatScore = localEpisode.Series.QualityProfile?.Value.CalculateCustomFormatScore(localEpisode.CustomFormats) ?? 0; + // TODO: Cleanup non-tracked downloads var importDecision = new ImportDecision(localEpisode);