1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: Parsing releases with year added to the end of the series title

Fixes #1768
This commit is contained in:
Mark McDowall 2017-03-18 22:30:51 -07:00
parent a0d98951aa
commit 3c22f68f5a
2 changed files with 28 additions and 0 deletions

View File

@ -39,6 +39,7 @@ public void Setup()
_parsedEpisodeInfo = new ParsedEpisodeInfo _parsedEpisodeInfo = new ParsedEpisodeInfo
{ {
SeriesTitle = _series.Title, SeriesTitle = _series.Title,
SeriesTitleInfo = new SeriesTitleInfo(),
SeasonNumber = 1, SeasonNumber = 1,
EpisodeNumbers = new[] { 1 } EpisodeNumbers = new[] { 1 }
}; };
@ -150,6 +151,28 @@ public void should_FindByTitle_when_search_criteria_matching_fails()
.Verify(v => v.FindByTitle(It.IsAny<string>()), Times.Once()); .Verify(v => v.FindByTitle(It.IsAny<string>()), Times.Once());
} }
[Test]
public void should_FindByTitle_using_year_when_FindByTitle_matching_fails()
{
GivenParseResultSeriesDoesntMatchSearchCriteria();
_parsedEpisodeInfo.SeriesTitleInfo = new SeriesTitleInfo
{
Title = "Series Title 2017",
TitleWithoutYear = "Series Title",
Year = 2017
};
Mocker.GetMock<ISeriesService>()
.Setup(s => s.FindByTitle(_parsedEpisodeInfo.SeriesTitleInfo.TitleWithoutYear, _parsedEpisodeInfo.SeriesTitleInfo.Year))
.Returns(_series);
Subject.Map(_parsedEpisodeInfo, 10, 10, _singleEpisodeSearchCriteria);
Mocker.GetMock<ISeriesService>()
.Verify(v => v.FindByTitle(It.IsAny<string>(), It.IsAny<int>()), Times.Once());
}
[Test] [Test]
public void should_FindByTvdbId_when_search_criteria_and_FindByTitle_matching_fails() public void should_FindByTvdbId_when_search_criteria_and_FindByTitle_matching_fails()
{ {

View File

@ -293,6 +293,11 @@ private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tv
series = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitle); series = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitle);
if (series == null && parsedEpisodeInfo.SeriesTitleInfo.Year > 0)
{
series = _seriesService.FindByTitle(parsedEpisodeInfo.SeriesTitleInfo.TitleWithoutYear, parsedEpisodeInfo.SeriesTitleInfo.Year);
}
if (series == null && tvdbId > 0) if (series == null && tvdbId > 0)
{ {
//TODO: If series is found by TvdbId, we should report it as a scene naming exception, since it will fail to import //TODO: If series is found by TvdbId, we should report it as a scene naming exception, since it will fail to import