mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Hopefully fixed sqlite errors when finding by title.
This commit is contained in:
parent
420cbf6dd0
commit
e7ad09cf62
@ -234,40 +234,40 @@ private Movie FindByTitle(string cleanTitle, int? year)
|
||||
cleanTitleWithArabicNumbers = cleanTitleWithArabicNumbers.Replace(romanNumber, arabicNumber);
|
||||
}
|
||||
|
||||
return Query(q =>
|
||||
Movie result = Query(q =>
|
||||
{
|
||||
Movie result = q.Where(s => s.CleanTitle == cleanTitle).FirstWithYear(year);
|
||||
return q.Where(s => s.CleanTitle == cleanTitle).FirstWithYear(year);
|
||||
});
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result =
|
||||
Query(q => q.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers).FirstWithYear(year)) ??
|
||||
Query(q => q.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers).FirstWithYear(year));
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result =
|
||||
q.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers).FirstWithYear(year) ??
|
||||
q.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers).FirstWithYear(year);
|
||||
/*IEnumerable<Movie> movies = All();
|
||||
Func<string, string> titleCleaner = title => CoreParser.CleanSeriesTitle(title.ToLower());
|
||||
Func<IEnumerable<AlternativeTitle>, string, bool> altTitleComparer =
|
||||
(alternativeTitles, atitle) =>
|
||||
alternativeTitles.Any(altTitle => altTitle.CleanTitle == atitle);*/
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
/*IEnumerable<Movie> movies = All();
|
||||
Func<string, string> titleCleaner = title => CoreParser.CleanSeriesTitle(title.ToLower());
|
||||
Func<IEnumerable<AlternativeTitle>, string, bool> altTitleComparer =
|
||||
(alternativeTitles, atitle) =>
|
||||
alternativeTitles.Any(altTitle => altTitle.CleanTitle == atitle);*/
|
||||
/*result = movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
|
||||
altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) ||
|
||||
altTitleComparer(m.AlternativeTitles, cleanTitleWithArabicNumbers)).FirstWithYear(year);*/
|
||||
|
||||
/*result = movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
|
||||
altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) ||
|
||||
altTitleComparer(m.AlternativeTitles, cleanTitleWithArabicNumbers)).FirstWithYear(year);*/
|
||||
//result = Query.Join<Movie, AlternativeTitle>(JoinType.Inner, m => m._newAltTitles,
|
||||
//(m, t) => m.Id == t.MovieId && (t.CleanTitle == cleanTitle)).FirstWithYear(year);
|
||||
result = Query(q => q.Where<AlternativeTitle>(t =>
|
||||
t.CleanTitle == cleanTitle || t.CleanTitle == cleanTitleWithArabicNumbers
|
||||
|| t.CleanTitle == cleanTitleWithRomanNumbers)
|
||||
.FirstWithYear(year));
|
||||
|
||||
//result = Query.Join<Movie, AlternativeTitle>(JoinType.Inner, m => m._newAltTitles,
|
||||
//(m, t) => m.Id == t.MovieId && (t.CleanTitle == cleanTitle)).FirstWithYear(year);
|
||||
result = q.Where<AlternativeTitle>(t =>
|
||||
t.CleanTitle == cleanTitle || t.CleanTitle == cleanTitleWithArabicNumbers
|
||||
|| t.CleanTitle == cleanTitleWithRomanNumbers)
|
||||
.FirstWithYear(year);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
return result;
|
||||
|
||||
/*return year.HasValue
|
||||
? results?.FirstOrDefault(movie => movie.Year == year.Value)
|
||||
|
Loading…
Reference in New Issue
Block a user