1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Mapping by MovieTitles collection instead of PrimaryMovieTitle (#8157)

Co-authored-by: Sergey M <msergein>
This commit is contained in:
Sergey M 2023-04-03 00:53:24 +03:00 committed by GitHub
parent 4627093616
commit b48eda95dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@
using NLog; using NLog;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Parser.RomanNumerals; using NzbDrone.Core.Parser.RomanNumerals;
@ -214,31 +213,15 @@ private bool TryGetMovieBySearchCriteria(ParsedMovieInfo parsedMovieInfo, Search
possibleTitles.AddRange(searchCriteria.Movie.MovieMetadata.Value.AlternativeTitles.Select(t => t.CleanTitle)); possibleTitles.AddRange(searchCriteria.Movie.MovieMetadata.Value.AlternativeTitles.Select(t => t.CleanTitle));
possibleTitles.AddRange(searchCriteria.Movie.MovieMetadata.Value.Translations.Select(t => t.CleanTitle)); possibleTitles.AddRange(searchCriteria.Movie.MovieMetadata.Value.Translations.Select(t => t.CleanTitle));
var cleanTitle = parsedMovieInfo.PrimaryMovieTitle.CleanMovieTitle(); var cleanTitles = parsedMovieInfo.MovieTitles.Select(t => t.CleanMovieTitle()).ToArray();
foreach (var title in possibleTitles) if (possibleTitles.Any(pt =>
cleanTitles.Contains(pt)
|| _arabicRomanNumeralMappings.Any(mn =>
cleanTitles.Contains(pt.Replace(mn.ArabicNumeralAsString, mn.RomanNumeralLowerCase))
|| cleanTitles.Any(t => t.Replace(mn.ArabicNumeralAsString, mn.RomanNumeralLowerCase) == pt))))
{ {
if (title == cleanTitle) possibleMovie = searchCriteria.Movie;
{
possibleMovie = searchCriteria.Movie;
}
foreach (var numeralMapping in _arabicRomanNumeralMappings)
{
var arabicNumeral = numeralMapping.ArabicNumeralAsString;
var romanNumeral = numeralMapping.RomanNumeralLowerCase;
// _logger.Debug(cleanTitle);
if (title.Replace(arabicNumeral, romanNumeral) == cleanTitle)
{
possibleMovie = searchCriteria.Movie;
}
if (title == cleanTitle.Replace(arabicNumeral, romanNumeral))
{
possibleMovie = searchCriteria.Movie;
}
}
} }
if (possibleMovie != null) if (possibleMovie != null)