From 890f9d6fe48716fc3e4272b5221238dd9404876c Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 22 Apr 2023 19:36:04 -0500 Subject: [PATCH] Fixed: Prevent error on manual import processing with multi languages Closes #7713 --- .../MediaFiles/MovieImport/Manual/ManualImportService.cs | 4 ++-- src/Radarr.Api.V3/ManualImport/ManualImportController.cs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs index 917102d9a..23e1a32d0 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs @@ -121,8 +121,8 @@ public ManualImportItem ReprocessItem(string path, string downloadId, int movieI SceneSource = SceneSource(movie, rootFolder), ExistingFile = movie.Path.IsParentPath(path), Size = _diskProvider.GetFileSize(path), - Languages = (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? languageParse : languages, - Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality, + Languages = languages?.Count <= 1 && (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? languageParse : languages, + Quality = (quality?.Quality ?? Quality.Unknown) == Quality.Unknown ? QualityParser.ParseQuality(path) : quality, ReleaseGroup = releaseGroup.IsNullOrWhiteSpace() ? Parser.Parser.ParseReleaseGroup(path) : releaseGroup, }; diff --git a/src/Radarr.Api.V3/ManualImport/ManualImportController.cs b/src/Radarr.Api.V3/ManualImport/ManualImportController.cs index 769f94cba..7914fc59d 100644 --- a/src/Radarr.Api.V3/ManualImport/ManualImportController.cs +++ b/src/Radarr.Api.V3/ManualImport/ManualImportController.cs @@ -35,7 +35,9 @@ public object ReprocessItems([FromBody] List item item.Movie = processedItem.Movie.ToResource(0); item.Rejections = processedItem.Rejections; - if (item.Languages.Single() == Language.Unknown) + + if (item.Languages?.Count <= 1 && (item.Languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown && + processedItem.Languages.Any()) { item.Languages = processedItem.Languages; } @@ -45,7 +47,7 @@ public object ReprocessItems([FromBody] List item item.Quality = processedItem.Quality; } - if (item.ReleaseGroup.IsNotNullOrWhiteSpace()) + if (item.ReleaseGroup.IsNullOrWhiteSpace()) { item.ReleaseGroup = processedItem.ReleaseGroup; }