Fixed an issue where movies which were labelled with an alternative title could not be found.

Fixes #557 Fixes #1387 Probably fixes #1372, probably fixes #555
Leonardo Galli 8 years ago
parent 33b48eec95
commit 32a2407ad1

@ -129,7 +129,14 @@ namespace NzbDrone.Core.Download
{ {
var statusMessages = importResults var statusMessages = importResults
.Where(v => v.Result != ImportResultType.Imported) .Where(v => v.Result != ImportResultType.Imported)
.Select(v => new TrackedDownloadStatusMessage(Path.GetFileName(v.ImportDecision.LocalMovie.Path), v.Errors)) .Select(v =>
{
if (v.ImportDecision.LocalMovie == null)
{
return new TrackedDownloadStatusMessage("", v.Errors);
}
return new TrackedDownloadStatusMessage(Path.GetFileName(v.ImportDecision.LocalMovie.Path), v.Errors);
})
.ToArray(); .ToArray();
trackedDownload.Warn(statusMessages); trackedDownload.Warn(statusMessages);

@ -178,7 +178,7 @@ namespace NzbDrone.Core.Parser
return _movieService.FindByTitle(title); return _movieService.FindByTitle(title);
} }
var movies = _movieService.FindByTitle(parsedMovieInfo.MovieTitle); var movies = _movieService.FindByTitle(parsedMovieInfo.MovieTitle, parsedMovieInfo.Year);
if (movies == null) if (movies == null)
{ {

@ -240,18 +240,18 @@ namespace NzbDrone.Core.Tv
IEnumerable<Movie> results = Query.Where(s => s.CleanTitle == cleanTitle); IEnumerable<Movie> results = Query.Where(s => s.CleanTitle == cleanTitle);
if (results == null) if (results == null || results.Count() == 0)
{ {
results = Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers) ?? results = Query.Where(movie => movie.CleanTitle == cleanTitleWithArabicNumbers) ??
Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers); Query.Where(movie => movie.CleanTitle == cleanTitleWithRomanNumbers);
if (results == null) if (results == null || results.Count() == 0)
{ {
IEnumerable<Movie> movies = All(); IEnumerable<Movie> movies = All();
Func<string, string> titleCleaner = title => CoreParser.CleanSeriesTitle(title.ToLower()); Func<string, string> titleCleaner = title => CoreParser.CleanSeriesTitle(title.ToLower());
Func<IEnumerable<string>, string, bool> altTitleComparer = Func<IEnumerable<string>, string, bool> altTitleComparer =
(alternativeTitles, atitle) => (alternativeTitles, atitle) =>
alternativeTitles.Any(altTitle => altTitle == titleCleaner(atitle)); alternativeTitles.Any(altTitle => titleCleaner(altTitle) == atitle);
results = movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) || results = movies.Where(m => altTitleComparer(m.AlternativeTitles, cleanTitle) ||
altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) || altTitleComparer(m.AlternativeTitles, cleanTitleWithRomanNumbers) ||

Loading…
Cancel
Save