1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-07-02 10:22:21 +02:00

Fixed: Calculate custom formats after setting user-chosen attributes in manual import

Necessary to calculate the correct scoring post-manual import for those custom formats that are dependent on other attributes like for example the quality.
This commit is contained in:
Bogdan 2024-06-27 03:32:45 +03:00
parent 92a19a1a81
commit 0f1cf21c39

View File

@ -308,6 +308,13 @@ private ManualImportItem MapItem(ImportDecision decision, string rootFolder, str
item.Name = Path.GetFileNameWithoutExtension(decision.LocalMovie.Path);
item.DownloadId = downloadId;
item.Quality = decision.LocalMovie.Quality;
item.Size = _diskProvider.GetFileSize(decision.LocalMovie.Path);
item.Languages = decision.LocalMovie.Languages;
item.ReleaseGroup = decision.LocalMovie.ReleaseGroup;
item.Rejections = decision.Rejections;
item.IndexerFlags = (int)decision.LocalMovie.IndexerFlags;
if (decision.LocalMovie.Movie != null)
{
item.Movie = decision.LocalMovie.Movie;
@ -316,13 +323,6 @@ private ManualImportItem MapItem(ImportDecision decision, string rootFolder, str
item.CustomFormatScore = item.Movie.QualityProfile?.CalculateCustomFormatScore(item.CustomFormats) ?? 0;
}
item.Quality = decision.LocalMovie.Quality;
item.Size = _diskProvider.GetFileSize(decision.LocalMovie.Path);
item.Languages = decision.LocalMovie.Languages;
item.ReleaseGroup = decision.LocalMovie.ReleaseGroup;
item.Rejections = decision.Rejections;
item.IndexerFlags = (int)decision.LocalMovie.IndexerFlags;
return item;
}
@ -371,8 +371,6 @@ public void Execute(ManualImportCommand message)
// Augment movie file so imported files have all additional information an automatic import would
localMovie = _aggregationService.Augment(localMovie, trackedDownload?.DownloadItem);
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
// Apply the user-chosen values.
localMovie.Movie = movie;
@ -381,6 +379,9 @@ public void Execute(ManualImportCommand message)
localMovie.Languages = file.Languages;
localMovie.IndexerFlags = (IndexerFlags)file.IndexerFlags;
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
// TODO: Cleanup non-tracked downloads
var importDecision = new ImportDecision(localMovie);