|
|
|
@ -238,14 +238,21 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
cleanTitleWithArabicNumbers = cleanTitleWithArabicNumbers.Replace(romanNumber, arabicNumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerable<Movie> results = Query.Where(s => s.CleanTitle == cleanTitle);
|
|
|
|
|
Movie result = year.HasValue
|
|
|
|
|
? Query.Where(s => s.CleanTitle == cleanTitle).FirstOrDefault(movie => movie.Year == year.Value)
|
|
|
|
|
: Query.Where(s => s.CleanTitle == cleanTitle).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (results == null || results.Count() == 0)
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
results = Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers) ??
|
|
|
|
|
Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers);
|
|
|
|
|
result = year.HasValue ? Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers).FirstOrDefault(movie => movie.Year == year.Value)
|
|
|
|
|
: Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers).FirstOrDefault(); ;
|
|
|
|
|
|
|
|
|
|
if (results == null || results.Count() == 0)
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
result = year.HasValue ? Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers).FirstOrDefault(movie => movie.Year == year.Value)
|
|
|
|
|
: Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
IEnumerable<Movie> movies = All();
|
|
|
|
|
Func<string, string> titleCleaner = title => CoreParser.CleanSeriesTitle(title.ToLower());
|
|
|
|
@ -253,14 +260,19 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
(alternativeTitles, atitle) =>
|
|
|
|
|
alternativeTitles.Any(altTitle => titleCleaner(altTitle) == atitle);
|
|
|
|
|
|
|
|
|
|
results = movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
|
|
|
|
|
result = year.HasValue ? movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
|
|
|
|
|
altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) ||
|
|
|
|
|
altTitleComparer(m.AlternativeTitles, cleanTitleWithArabicNumbers));
|
|
|
|
|
altTitleComparer(m.AlternativeTitles, cleanTitleWithArabicNumbers)).FirstOrDefault(movie => movie.Year == year)
|
|
|
|
|
: movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
|
|
|
|
|
altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) ||
|
|
|
|
|
altTitleComparer(m.AlternativeTitles, cleanTitleWithArabicNumbers)).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return year.HasValue
|
|
|
|
|
return result;
|
|
|
|
|
/*return year.HasValue
|
|
|
|
|
? results?.FirstOrDefault(movie => movie.Year == year.Value)
|
|
|
|
|
: results?.FirstOrDefault();
|
|
|
|
|
: results?.FirstOrDefault();*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Movie FindByTmdbId(int tmdbid)
|
|
|
|
|