1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-26 04:33:01 +01:00

Fixed: Calculate Custom Formats after user specified options in Manual Import

This commit is contained in:
Bogdan 2024-07-06 02:33:33 +03:00 committed by GitHub
parent 5c327d5be3
commit ac1da45ecd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -395,14 +395,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
item.Name = Path.GetFileNameWithoutExtension(decision.LocalEpisode.Path); item.Name = Path.GetFileNameWithoutExtension(decision.LocalEpisode.Path);
item.DownloadId = downloadId; 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) 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(); 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.IndexerFlags = (int)decision.LocalEpisode.IndexerFlags;
item.ReleaseType = decision.LocalEpisode.ReleaseType; 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; 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 // Augment episode file so imported files have all additional information an automatic import would
localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem); 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. // Apply the user-chosen values.
localEpisode.Series = series; localEpisode.Series = series;
@ -518,6 +516,9 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
localEpisode.IndexerFlags = (IndexerFlags)file.IndexerFlags; localEpisode.IndexerFlags = (IndexerFlags)file.IndexerFlags;
localEpisode.ReleaseType = file.ReleaseType; localEpisode.ReleaseType = file.ReleaseType;
localEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(localEpisode);
localEpisode.CustomFormatScore = localEpisode.Series.QualityProfile?.Value.CalculateCustomFormatScore(localEpisode.CustomFormats) ?? 0;
// TODO: Cleanup non-tracked downloads // TODO: Cleanup non-tracked downloads
var importDecision = new ImportDecision(localEpisode); var importDecision = new ImportDecision(localEpisode);