From 0dc67419befe1d3d45c352a3aa9726a9312a4386 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 20 Mar 2017 21:51:48 -0400 Subject: [PATCH] Revert "Move up IMDB logic in ParsingService, should help with the mismatched movies" This reverts commit 066c746e5f411f255e0ea0d38cead1da955e4f0e. --- src/NzbDrone.Core/Parser/ParsingService.cs | 46 +++++++++++++--------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 2911c2e13..52db77468 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -354,17 +354,12 @@ namespace NzbDrone.Core.Parser private Movie GetMovie(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria) { - // IMDbID is present, movie this logic up - if (imdbId.IsNotNullOrWhiteSpace()) - { - return _movieService.FindByImdbId(imdbId); - } - - Movie possibleMovie = null; - if (searchCriteria != null) { var possibleTitles = new List(); + + Movie possibleMovie = null; + possibleTitles.Add(searchCriteria.Movie.CleanTitle); foreach (string altTitle in searchCriteria.Movie.AlternativeTitles) @@ -396,35 +391,48 @@ namespace NzbDrone.Core.Parser } } - if (possibleMovie != null && (parsedMovieInfo.Year < 1900 || possibleMovie.Year == parsedMovieInfo.Year)) - { - return possibleMovie; - } + if (possibleMovie != null && (parsedMovieInfo.Year < 1800 || possibleMovie.Year == parsedMovieInfo.Year)) + { + return possibleMovie; + } + + } - else + + Movie movie = null; + + if (searchCriteria == null) { if (parsedMovieInfo.Year > 1900) { - possibleMovie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle, parsedMovieInfo.Year); + movie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle, parsedMovieInfo.Year); } else { - possibleMovie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle); + movie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle); } - if (possibleMovie == null) + if (movie == null) { - possibleMovie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle); + movie = _movieService.FindByTitle(parsedMovieInfo.MovieTitle); } + // return movie; } - if (possibleMovie == null) + + + if (movie == null && imdbId.IsNotNullOrWhiteSpace()) + { + movie = _movieService.FindByImdbId(imdbId); + } + + if (movie == null) { _logger.Debug($"No matching movie {parsedMovieInfo.MovieTitle}"); return null; } - return possibleMovie; + return movie; } private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria)