1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Reprocessing manual import items unable to detect sample

(cherry picked from commit 27da0413882dc87e1617a5d091ac5111589e61a6)

Closes #10463
This commit is contained in:
Mark McDowall 2024-09-16 21:45:09 -07:00 committed by Bogdan
parent a692c35b03
commit 9df45199d0

View File

@ -102,8 +102,6 @@ public ManualImportItem ReprocessItem(string path, string downloadId, int movieI
var rootFolder = Path.GetDirectoryName(path); var rootFolder = Path.GetDirectoryName(path);
var movie = _movieService.GetMovie(movieId); var movie = _movieService.GetMovie(movieId);
var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem;
var languageParse = LanguageParser.ParseLanguages(path); var languageParse = LanguageParser.ParseLanguages(path);
if (languageParse.Count <= 1 && languageParse.First() == Language.Unknown && movie != null) if (languageParse.Count <= 1 && languageParse.First() == Language.Unknown && movie != null)
@ -112,6 +110,16 @@ public ManualImportItem ReprocessItem(string path, string downloadId, int movieI
_logger.Debug("Language couldn't be parsed from release, fallback to movie original language: {0}", movie.MovieMetadata.Value.OriginalLanguage.Name); _logger.Debug("Language couldn't be parsed from release, fallback to movie original language: {0}", movie.MovieMetadata.Value.OriginalLanguage.Name);
} }
var downloadClientItem = GetTrackedDownload(downloadId)?.DownloadItem;
var finalReleaseGroup = releaseGroup.IsNullOrWhiteSpace()
? Parser.Parser.ParseReleaseGroup(path)
: releaseGroup;
var finalQuality = (quality?.Quality ?? Quality.Unknown) == Quality.Unknown ? QualityParser.ParseQuality(path) : quality;
var finalLanguages =
languages?.Count <= 1 && (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown
? languageParse
: languages;
var localMovie = new LocalMovie(); var localMovie = new LocalMovie();
localMovie.Movie = movie; localMovie.Movie = movie;
localMovie.FileMovieInfo = Parser.Parser.ParseMoviePath(path); localMovie.FileMovieInfo = Parser.Parser.ParseMoviePath(path);
@ -121,13 +129,24 @@ public ManualImportItem ReprocessItem(string path, string downloadId, int movieI
localMovie.SceneSource = SceneSource(movie, rootFolder); localMovie.SceneSource = SceneSource(movie, rootFolder);
localMovie.ExistingFile = movie.Path.IsParentPath(path); localMovie.ExistingFile = movie.Path.IsParentPath(path);
localMovie.Size = _diskProvider.GetFileSize(path); localMovie.Size = _diskProvider.GetFileSize(path);
localMovie.ReleaseGroup = releaseGroup.IsNullOrWhiteSpace() ? Parser.Parser.ParseReleaseGroup(path) : releaseGroup; localMovie.ReleaseGroup = finalReleaseGroup;
localMovie.Languages = languages?.Count <= 1 && (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? languageParse : languages; localMovie.Languages = finalLanguages;
localMovie.Quality = (quality?.Quality ?? Quality.Unknown) == Quality.Unknown ? QualityParser.ParseQuality(path) : quality; localMovie.Quality = finalQuality;
localMovie.IndexerFlags = (IndexerFlags)indexerFlags; localMovie.IndexerFlags = (IndexerFlags)indexerFlags;
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie); localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie?.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0; localMovie.CustomFormatScore = localMovie.Movie?.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;
// Augment movie file so imported files have all additional information an automatic import would
localMovie = _aggregationService.Augment(localMovie, downloadClientItem);
// Reapply the user-chosen values.
localMovie.Movie = movie;
localMovie.ReleaseGroup = finalReleaseGroup;
localMovie.Quality = finalQuality;
localMovie.Languages = finalLanguages;
localMovie.IndexerFlags = (IndexerFlags)indexerFlags;
return MapItem(_importDecisionMaker.GetDecision(localMovie, downloadClientItem), rootFolder, downloadId, null); return MapItem(_importDecisionMaker.GetDecision(localMovie, downloadClientItem), rootFolder, downloadId, null);
} }