mirror of https://github.com/Radarr/Radarr
Merge branch 'feature/better-mapping-info' into develop
This commit is contained in:
commit
096d24ed91
|
@ -350,7 +350,7 @@ namespace NzbDrone.Core.Parser
|
||||||
private Movie GetMovie(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria)
|
private Movie GetMovie(ParsedMovieInfo parsedMovieInfo, string imdbId, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
// TODO: Answer me this: Wouldn't it be smarter to start out looking for a movie if we have an ImDb Id?
|
// TODO: Answer me this: Wouldn't it be smarter to start out looking for a movie if we have an ImDb Id?
|
||||||
if (!String.IsNullOrWhiteSpace(imdbId))
|
if (!String.IsNullOrWhiteSpace(imdbId) && imdbId != "0")
|
||||||
{
|
{
|
||||||
Movie movieByImDb;
|
Movie movieByImDb;
|
||||||
if (TryGetMovieByImDbId(parsedMovieInfo, imdbId, out movieByImDb))
|
if (TryGetMovieByImDbId(parsedMovieInfo, imdbId, out movieByImDb))
|
||||||
|
@ -403,6 +403,8 @@ namespace NzbDrone.Core.Parser
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
movieByTitleAndOrYear = _movieService.FindByTitle(parsedMovieInfo.MovieTitle);
|
movieByTitleAndOrYear = _movieService.FindByTitle(parsedMovieInfo.MovieTitle);
|
||||||
if (isNotNull(movieByTitleAndOrYear))
|
if (isNotNull(movieByTitleAndOrYear))
|
||||||
|
@ -686,4 +688,30 @@ namespace NzbDrone.Core.Parser
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MappingException : Exception
|
||||||
|
{
|
||||||
|
public virtual string Reason()
|
||||||
|
{
|
||||||
|
return "Parsed movie does not match wanted movie";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class YearDoesNotMatchException : MappingException
|
||||||
|
{
|
||||||
|
public int ExpectedYear { get; set; }
|
||||||
|
public int? ParsedYear { get; set; }
|
||||||
|
|
||||||
|
override public string Reason()
|
||||||
|
{
|
||||||
|
if (ParsedYear.HasValue && ParsedYear > 1800)
|
||||||
|
{
|
||||||
|
return $"Expected {ExpectedYear}, but found {ParsedYear} for year";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Did not find a valid year";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue