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
.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();
trackedDownload.Warn(statusMessages);

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

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

Loading…
Cancel
Save