1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-24 17:25:22 -04:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Leonardo Galli
3c8162f1d6 Fix test. 2017-05-12 16:52:38 +02:00
Leonardo Galli
096d24ed91 Merge branch 'feature/better-mapping-info' into develop 2017-05-12 16:09:35 +02:00
Leonardo Galli
63e3361fb5 Movies with same name but different year being downloaded regardlessly is now fixed! 2017-05-12 16:09:23 +02:00
Leonardo Galli
51854ef73b Update TaskManager.cs 2017-05-11 23:05:12 +02:00
3 changed files with 32 additions and 4 deletions

View File

@@ -129,7 +129,7 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
Subject.Map(_parsedMovieInfo, "", null);
Mocker.GetMock<IMovieService>()
.Verify(v => v.FindByTitle(It.IsAny<string>()), Times.Once());
.Verify(v => v.FindByTitle(It.IsAny<string>(), It.IsAny<int>()), Times.Once());
}
[Test]

View File

@@ -134,9 +134,9 @@ namespace NzbDrone.Core.Jobs
{
var interval = _configService.RssSyncInterval;
if (interval > 0 && interval < 10)
if (interval > 0 && interval < 5)
{
return 10;
return 5;
}
if (interval < 0)

View File

@@ -350,7 +350,7 @@ namespace NzbDrone.Core.Parser
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?
if (!String.IsNullOrWhiteSpace(imdbId))
if (!String.IsNullOrWhiteSpace(imdbId) && imdbId != "0")
{
Movie movieByImDb;
if (TryGetMovieByImDbId(parsedMovieInfo, imdbId, out movieByImDb))
@@ -403,6 +403,8 @@ namespace NzbDrone.Core.Parser
{
return true;
}
return false;
}
movieByTitleAndOrYear = _movieService.FindByTitle(parsedMovieInfo.MovieTitle);
if (isNotNull(movieByTitleAndOrYear))
@@ -686,4 +688,30 @@ namespace NzbDrone.Core.Parser
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";
}
}
}
}